Re: [CMake] organizing includes statements

2015-12-10 Thread Owen Alanzo Hogarth
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

Re: [CMake] organizing includes statements

2015-12-10 Thread Owen Alanzo Hogarth
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

Re: [CMake] organizing includes statements

2015-12-10 Thread iosif neitzke
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

Re: [CMake] organizing includes statements

2015-12-10 Thread Raymond Wan
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) >

[CMake] organizing includes statements

2015-12-09 Thread Owen Alanzo Hogarth
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)

Re: [CMake] organizing includes statements

2015-12-09 Thread Attila Krasznahorkay
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

Re: [CMake] organizing includes statements

2015-12-09 Thread Owen Alanzo Hogarth
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)