Knitschi / CPFCMake

A component of the CMakeProjectFramework. It provides the CMake code that implements a CI-pipeline.
MIT License
2 stars 2 forks source link

Replace usage of CMAKE_CXX_FLAGS with target_compile_options( <target> PRIVATE ...) #12

Closed Knitschi closed 5 years ago

Knitschi commented 6 years ago

The target_compile_option() function will set the target properties instead of the global flag. The variable is currently used for setting the cosmetic compiler options like waring level, warning as error and /MP flag.

Knitschi commented 5 years ago

Currently the code that sets these flags is in the functions cpfSetDynamicAndCosmeticCompilerOptions() and cpfSetHighWarningLevel(). cpfAddCppPackage() should have an extra option like COSMETIC_COMPILE_OPTIONS that can be used to set /MP and warning flags. Currently we force this on the user.

Knitschi commented 5 years ago

cpfAddCppPackage() no longer sets the CMAKE_CXX_FLAGS. Instead the flags must now be added to the configurations with the CPF_COSMETIC_COMPILE_OPTIONS variable.