[CMake] How to specify compiler only flags

Daniel Schepler dschepler at scalable-networks.com
Tue Apr 28 16:22:51 EDT 2015


As I understand it, configuration-specific properties are deprecated in favor of generator expressions.  For example:

target_compile_options(openjpeg PRIVATE
  $<$<CONFIG:Release>:-ffast-math>)
-- 
Daniel Schepler
________________________________________
From: CMake [cmake-bounces at cmake.org] on behalf of Orion Poplawski [orion at cora.nwra.com]
Sent: Tuesday, April 28, 2015 1:15 PM
To: CMake Mailing List
Subject: [CMake] How to specify compiler only flags

I'm trying to patch the CMakeLists.txt for openjpeg.  Currently it does:

   # Do not use ffast-math for all build, it would produce incorrect results,
only set for release:
   SET(CMAKE_C_FLAGS_RELEASE "-ffast-math ${CMAKE_C_FLAGS_RELEASE}")


Unfortunately, CMAKE_C_FLAGS are also used in link step, which for -ffast-math
causes problems for users of the shared library.

I'm unable to find an equivalent flag that is for compiling only.  I see I can
set the COMPILE_FLAGS property for the library, but there does not appear to
be a COMPILE_FLAGS_RELEASE property that would only set it for the Release
build type.

Suggestions?

--
Orion Poplawski
Technical Manager                     303-415-9701 x222
NWRA, Boulder/CoRA Office             FAX: 303-415-9702
3380 Mitchell Lane                       orion at nwra.com
Boulder, CO 80301                   http://www.nwra.com
--

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



More information about the CMake mailing list