[CMake] How to specify compiler only flags

Orion Poplawski orion at cora.nwra.com
Tue Apr 28 16:15:36 EDT 2015


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


More information about the CMake mailing list