2014/1/20 Rob McDonald <[email protected]>: > We also have an API/Library mode with no main(), but that can have graphics > or not.
So, one will have the library with unpredictable API/ABI? > > I'd like to use CMake to compile both versions of these in one go. However, > I don't see any way to make a -DFOO for just a single file, or to compile > two versions of a single object to then be used later. > > I think the workaround will be to have two CMakeLists.txt a level deeper > than the file with main(). > > > \maindir > CMakeLists.txt_1 > main.cpp > \maindir\graphics > CMakeLists.txt_2 > \maindir\headless > CMakeLists.txt_3 > > Where... > CMakeLists.txt_1 is basically: > add_directory( graphics ) > add_directory( headless ) > > And then _2 and _3 set the -DFOO at their level and include the source with > a ../main.cpp > > Is there another/better way? Sure, don't do that ;-) If *you* need a one-shot way to build all variants, write a script. This document can be useful https://wiki.debian.org/UpstreamGuide -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
