Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The whole philosophy is to start with a central CMakeLists.txt for your whole project. At this level all the targets (libs, executables) are gonna be aggregated so there will be no problem linking from lib1 to lib2 for example. If lib2 is gonna be linking to lib1, lib1 needs to be built first.</p> <p>Platform specific source files should be set conditionally to some variable. (If you need to set variable in a subdirectory and use it in a directory above, you have to set it to the cache, using CACHE FORCE etc. - see manual for <code>set</code>)</p> <p>This is how you do proper out of source build - as CMake intends:</p> <pre><code>cd project-build cmake ../project </code></pre> <p>Having separate build directories per library is not very CMake'ish (if I may say so) and would probably require some hacks.</p> <pre><code>project-build/ project/ CMakeLists.txt (whole project CMakeLists.txt) [ project(MyAwesomeProject) include_directories(include) # allow lib1 and lib2 to include lib1/lib.h and lib2/lib.h add_subdirectory(lib1) # this adds target lib1 add_subdirectory(lib2) # this adds target lib2 ] lib1/ (first library) CMakeList.txt [ add_library(lib1...) add_subdirectory(test) ] src/ lib1.c foo1.h test/ (tests) CMakeList.txt test1.c test2.c lib2/ (second library) CMakeList.txt [ add_subdirectory(src) ] src/ CMakeList.txt [ if(WIN32) set(lib2_os_sources os/win32/xxx.c) elsif(LINUX) set(lib2_os_sources os/linux/xxx.c) else() message(FATAL_ERROR "Unsupported OS") endif() add_library(lib2 SHARED lib2.c ${lib2_os_sources}) ] os/ (OS dependent code) win32/ xxx.c (win32 implementation) linux/ xxx.c (linux implementation) lib2.c foo2.h include/ (shared/public headers) lib1/ lib.h (shared library header included from apps) lib2/ lib.h (shared library header -"-) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload