How can I write a CMakeLists.txt
file that accepts different out-of-source builds? I'm not talking about Debug and Release, but more about something like one build for remote testing one for local testing, etc.
For example: If I go into the build_local
build directory and run make
I want to have the sources compiled for local configration. If I run make
in the build_production
build directory I want to compile the sources using a different configuration. I understand that out of source builds are what I need. I just don't quite understand how to:
- tell cmake what kind of configuration to generate (e.g.,
cd build_local; cmake -D local
?) - how to write a
CMakeLists.txt
file in a way that it generates different default target (i.e.make all
ormake
) depending on the configuration
Has someone an example or a link to appropriate documentation?
Thanks!