Reputation: 1868
Sorry for the vague title, I'm not sure how to phrase this correctly. I would like to write a cmake script that allows to build a target with different settings for bit width (forced 32 bit, forced 64 bit or native bit width) and static linking. I figured out how to set up the build under each condition and so far I'm using cmake options to switch between different setups.
My problem is that changing one of these build options with ccmake or on the command line also requires to look for new library paths. Since these paths are cached, I currently have to delete the cache when changing bit width. This way users also loose all other settings for options that are independent of bit width and static linking.
Is there a common way to handle this?
Upvotes: 0
Views: 175
Reputation:
Use different build directories for different settings:
Note that in each case there may be exceptions, like:
add_library(foo STATIC ${FOO_SOURCES}) # BUILD_SHARED_LIBS will be ignored
or for Visual Studio and Xcode Debug/Release will be:
cmake -H. -B_builds/xcode -GXcode
cmake --build _builds/xcode --config Debug # build Debug
cmake --build _builds/xcode --config Release # build Release
instead of xcode-debug
and xcode-release
Upvotes: 1