Hi Joseph,
On Mon, Jul 21, 2014 at 4:51 PM, Joseph Rosensweig <[email protected]>
wrote:
> ...
>
in my CMAKE I have places where I do things like if(CMAKE_BUILD_TYPE
> STREQUAL Debug) then do this else do that.
>
This is the sort of logic best achieved through generator expressions. How
to do it specifically really depends. Generator expressions are used all
over CMake in various different contexts so how to apply them depends on
what exactly you are trying to achieve.
> i.e. my CXX Flags will change based on the CMAKE_BUILD_TYPE ... What am I
> missing?
>
This is actually much simpler than the general case. CMake has specific
compiler flags for all builds, release, debug, release with debug info, and
minimum size release. They can be set / ammended with:
# Flags that get applied to all builds
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /My /EXTRA /COMPILER /FLAGS")
# Flags that only apply to debug builds
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /ADDITIONAL /DEBUG
/ONLY /FLAGS")
# Flags that only apply to release builds
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /ADDITIONAL
/RELEASE /ONLY /FLAGS")
The resulting compiler flags that get used are a combination of the general
CMAKE_CXX_FLAGS and CMAKE_CXX_FLAGS for the current selected build
configuration.
Back to the first issue though, what other types of build-type specific
logic are you trying to achieve? There may be a better / easier way.
--
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://public.kitware.com/mailman/listinfo/cmake