oh cool
adding target_include_directories(lib1 PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/headers)
and then I can just use #include "lib1" where needed. No more of those very
static paths!
Thank you very much!
On Thu, Dec 10, 2015 at 4:08 PM, iosif neitzke <
iosif.neitzke+cm...@gmail.com> wrote:
> I
that's actually a good point. Currently as I am developing this i am doing
an out of source build and just testing it from there but eventually what I
want is a shared library that can be used by other programs.
currently though my other programs is just a simple main.c that includes
the main
I would think
add_library( lib1 SHARED lib1/lib1.c )
target_include_directories( lib1 PUBLIC lib1/headers )
is simpler. Are the generator expressions needed for target export
install commands, and is exporting targets at install preferred to
add_subdirectory() ?
On Thu, Dec 10, 2015 at 1:48
Hi Owen,
Sorry to jump into the discussion, but what you're talking is
something I was thinking of just recently...
I think the choice between this:
On Thu, Dec 10, 2015 at 3:48 PM, Owen Alanzo Hogarth
wrote:
> set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
>
hi
I am building a shared library project that's composed of many smaller
shared library files.
Here's the main shared library project and a list of all the sub projects.
SET(HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/headers/main_lib.h)
SET(SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/main_lib.c)
Hi Owen,
This seems like a textbook example of using target_include_directories(…) with
generator expressions. Let’s take the example where:
lib1/headers/lib1.h
lib1/lib1.c
lib2/headers/lib2.h
lib2/lib2.c
If you want to be able to include lib1.h and lib2.h with simply
#include “lib1.h”
and
my main CMakeLists.txt file already has a few directives that move the libs
to an output folder so the binaries go to /bin while static and shared
libraries go to /lib
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)