My current project has many components that need to be built. Some portions of our code depend on others and using add_subdirectory, I am having an issue where I get multiple of my targets loaded causing a faliure.
I placed the add_subdirectory in a macro that uses a simple hash style of access set ( BUILD_MAP_${_name} 1 ) where ${_name} is the target name. I have an if statement in the macro that tests if BUILD_MAP_${_name} is defined. The issue is say I have a custom mysqlclient that is used by 3 of my projects that are all built as part of "all". Project A: Depends on Mysqlclient Project B: Depends on Mysqlclient Project C: Depends on Mysqlclient Dir structure all/ /lib/Mysqlclient /bin/Project A /bin/Project B /bin/Project C each of these folders have a CMakeLists.txt. The all/CMakeLists.txt has the following project(all) add_subdirectory(lib/Mysqlclient) add_subdirectory(bin/Project A) add_subdirectory(bin/Project B) add_subdirectory(bin/Project C) When building from the top level and having a definition of "-lmysqlclient" everything works as expected. The issue comes up when I do not want to build all of the source. Say I would like to build only Project B. from my build directory, I would run cmake ~/all/Project B. The cmake process ends without issue, but the make fails on link due to the missing Mysqlclient library not being built. I want to be able to declare dependencies for each project that way I can build each seperately from the top level. So far using a macro to do the add_subdirectory fails because even though I check to see if BUILD_MAP_${_name} is defined, the add_subdirectory command is still run as if the BUILD_MAP_${_name} is not defined (if defined, only an add_dependencies should be run) Any help would be greatly appreciated. ________________________________ This message (including any attachments) contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, you should delete this message. Any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited.
_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake