I have some huge project that is being compiled in CMake. It is developed for quite a long time, have 8000+ source/header files (over 500Mbytes, over 500 CMakefile.txt files).
They use directory structure like this
PROJECT_NAME
src
/ subdir_name
/ other_dir_name
/ some_different_dir
/ MY_SPECIFIC_DIR <---
/ yet_another_dir
build
and build it out-source, like this:
name@host:~/PROJECT_NAME/build> cmake ../src
name@host:~/PROJECT_NAME/build> make all
then it's build as one BIG binary (details are not important).
I cannot touch anything else, just content of MY_SPECIFIC_DIR
- it's source and CMake files.
So, I have source code in MY_SPECIFIC_DIR
tweak CMakefile.txt files somehow and would like to build it like this:
name@host:~/PROJECT_NAME/build_specific> cmake ../src/MY_SPECIFIC_DIR
name@host:~/PROJECT_NAME/build_specific> make all
This should build things in MY_SPECIFIC_DIR
into single binary with some few links to other subprojects. But also (obviously) don't change anything about how whole project is compiled.
Is my desired setup
posible
using CMake?
Can I somehow test in CMakeFile.txt
that it is root project and build it in different way then when it is builded as a whole?
Unless, I have to resort to different means and use standard make
for this.
I don't know CMake so I'm hoping for YES/NO anwer, preferable even for technique how to achieve this. And then learn the CMake and do it.
Also, I must use CMake version 2.6.
Thanks
Basic concept is to use
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
... code for stand-alone app
else()
... what was in this file before
endif()