[CMake] add_subdirectory and link_directories

Andrea Galeazzi Galeazzi at korg.it
Mon Jan 10 12:24:02 EST 2011


I've got a main project which relies on several sub-library projects, so 
the main CMakeLists.txt
add_subdirectory("W:/Omega/Kernel"  "${CMAKE_CURRENT_BINARY_DIR}/myLib1")
...........
and then I also specify the directory where all libraries have been 
built (by setting ARCHIVE_OUTPUT_DIRECTORY for each library)
link_directories("${ROOT_LIB}/{CMAKE_SYSTEM_NAME}/${CMAKE_BUILD_TYPE}")
Anyway I noticed that the build process works fine also without 
declaring the row above.
My question: is specifying  link_directories useless when I use 
add_subdirectory in order to build a library? If yes, is that true 
regardless the target (I only tested it in VS2010 and MinGW)?
Cheers


More information about the CMake mailing list