better -ffast-math handling 555/head
authorRex Dieter <rdieter@math.unl.edu>
Thu, 30 Jul 2015 14:53:35 +0000 (09:53 -0500)
committerRex Dieter <rdieter@math.unl.edu>
Thu, 30 Jul 2015 14:54:07 +0000 (09:54 -0500)
issue #488

See also
http://public.kitware.com/pipermail/cmake/2015-April/060479.html

CMakeLists.txt
src/lib/openjp2/CMakeLists.txt
src/lib/openjp3d/CMakeLists.txt
src/lib/openjpip/CMakeLists.txt
src/lib/openjpwl/CMakeLists.txt
src/lib/openmj2/CMakeLists.txt

index 79f66c357ba03db6bee622bb5be7909077a91951..7898d15ca76f115acd7be6a5c896227d00073f23 100644 (file)
@@ -190,7 +190,7 @@ if(CMAKE_COMPILER_IS_GNUCC)
   # For all builds, make sure openjpeg is std99 compliant:
   # set(CMAKE_C_FLAGS "-Wall -std=c99 ${CMAKE_C_FLAGS}") # FIXME: this setting prevented us from setting a coverage build.
   # 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}")
+  SET(OPENJPEG_LIBRARY_COMPILE_OPTIONS ${OPENJPEG_LIBRARY_COMPILE_OPTIONS} "$<$<CONFIG:Release>:-ffast-math>")
 endif()
 
 #-----------------------------------------------------------------------------
index 414664f9e388026cb0472e3859a1a1c53d2f6908..4a865e5d44ceaf47b23b0f8537a9b6d84ff958c9 100644 (file)
@@ -85,6 +85,7 @@ if(UNIX)
   target_link_libraries(${OPENJPEG_LIBRARY_NAME} m)
 endif()
 set_target_properties(${OPENJPEG_LIBRARY_NAME} PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES})
+target_compile_options(${OPENJPEG_LIBRARY_NAME} PRIVATE ${OPENJPEG_LIBRARY_COMPILE_OPTIONS})
 
 # Install library
 install(TARGETS ${OPENJPEG_LIBRARY_NAME}
index 8f034ffeb7e308ff32b28b77590ae3c3ac9a9143..df7c9be2a74572a37bc276a6eb1fe2348da8f409 100644 (file)
@@ -27,6 +27,7 @@ if(UNIX)
   target_link_libraries(${OPENJP3D_LIBRARY_NAME} m)
 endif()
 set_target_properties(${OPENJP3D_LIBRARY_NAME} PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES})
+target_compile_options(${OPENJP3D_LIBRARY_NAME} PRIVATE ${OPENJPEG_LIBRARY_COMPILE_OPTIONS})
 
 # Install library
 install(TARGETS ${OPENJP3D_LIBRARY_NAME}
index c149ef3fafcef7b8b3eaf51cae54f545ec4bdffa..28e8259d930ab085d0d480c0a6bc1a3e1b249854 100644 (file)
@@ -61,6 +61,7 @@ endif()
 add_library(openjpip ${OPENJPIP_SRCS} ${LOCAL_SRCS})
 set_target_properties(openjpip
   PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES})
+target_compile_options(openjpip PRIVATE ${OPENJPEG_LIBRARY_COMPILE_OPTIONS})
 target_link_libraries(openjpip ${OPENJPEG_LIBRARY_NAME})
 if(WIN32)
   # add Winsock on windows+mingw
index 616edf58c06d20b99fff7f9d7da66742114a8cda..00773db1caa6eb47c7431a4a21b53703bdd68ac0 100644 (file)
@@ -51,6 +51,7 @@ if(UNIX)
 endif()
 set_target_properties(openjpwl
   PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES})
+target_compile_options(openjpwl PRIVATE ${OPENJPEG_LIBRARY_COMPILE_OPTIONS})
 
 # Install library
 install(TARGETS openjpwl
index 775c931859513c22ca98e239611298194fafbf35..6fb8709bf1b0557f44bb11eeaf569c7e3ad3e4ef 100644 (file)
@@ -46,6 +46,7 @@ if(UNIX)
   target_link_libraries(${OPENMJ2_LIBRARY_NAME} m)
 endif()
 set_target_properties(${OPENMJ2_LIBRARY_NAME} PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES})
+target_compile_options(${OPENJ2_LIBRARY_NAME} PRIVATE ${OPENJPEG_LIBRARY_COMPILE_OPTIONS})
 
 # Install library
 install(TARGETS ${OPENMJ2_LIBRARY_NAME}