I'm trying to have different CMakeLists.txt
for different platforms with some stuff pre-configured, such as CMake variables that will control arbitrary parameters during the build. For example: for this platform enable static build and do not build that source directory. I'd like to have a structure similar to this:
root\
projects\
win32\CMakeList.txt
Android\CMakeList.txt
VAX\CMakeList.txt
cmake\cmake_scripts.cmake
src\
library\
I'm not sure how to configure this "the right way". I've seen some solutions with a script configuring variables and such before opening the CMakeList.txt
file, but I feel that adding a 3rd step to build is wrong.
I've tried to add the parent directory with add_subdirectory
but cmake complains that root
is not a subdirectory of win32
, which is true.
I've tried to include
root\CMakeList.txt
from a leaf, but some paths are not right, so I've resorted to set CMAKE_SOURCE_DIR
which broke most of cmake scripts.
Seriously, the scripting equivalent is something like
cd ../..
change_working_directory('.')
exec('foo')