From 00aa36a6905f2fef640b862f679e12bb98cb93b4 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 17 Sep 2019 15:44:14 -0500 Subject: Correct HDF5 options to tristate values --- config/cmake/HDFCompilerFlags.cmake | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index 37ddcbb..adace89 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -346,10 +346,12 @@ endif () # By default, CMake adds NDEBUG to CMAKE_${lang}_FLAGS for Release build types # This option will force/override the default setting for all configurations #----------------------------------------------------------------------------- -option (HDF5_ENABLE_ASSERTS "Determines whether NDEBUG is defined to control assertions." OFF) -if (HDF5_ENABLE_ASSERTS) +#option (HDF5_ENABLE_ASSERTS "Determines whether NDEBUG is defined to control assertions." OFF) +set (HDF5_ENABLE_ASSERTS "OFF" CACHE STRING "Determines whether NDEBUG is defined to control assertions (OFF NO YES)") +set_property (CACHE HDF5_ENABLE_ASSERTS PROPERTY STRINGS OFF NO YES) +if (HDF5_ENABLE_ASSERTS MATCHES "YES") add_compile_options ("-UNDEBUG") -else () +elseif (HDF5_ENABLE_ASSERTS MATCHES "NO") add_compile_options ("-DNDEBUG") endif () MARK_AS_ADVANCED (HDF5_ENABLE_ASSERTS) @@ -358,8 +360,10 @@ MARK_AS_ADVANCED (HDF5_ENABLE_ASSERTS) # Option for --enable-symbols # This option will force/override the default setting for all configurations #----------------------------------------------------------------------------- -option (HDF5_ENABLE_SYMBOLS "Add debug symbols to the library independent of the build mode and optimization level." OFF) -if (HDF5_ENABLE_SYMBOLS) +#option (HDF5_ENABLE_SYMBOLS "Add debug symbols to the library independent of the build mode and optimization level." OFF) +set (HDF5_ENABLE_SYMBOLS "OFF" CACHE STRING "Add debug symbols to the library independent of the build mode and optimization level (OFF NO YES)") +set_property (CACHE HDF5_ENABLE_SYMBOLS PROPERTY STRINGS OFF NO YES) +if (HDF5_ENABLE_SYMBOLS MATCHES "YES") if (CMAKE_C_COMPILER_ID STREQUAL "Intel") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") @@ -372,7 +376,7 @@ if (HDF5_ENABLE_SYMBOLS) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") endif () endif () -else () +elseif (HDF5_ENABLE_SYMBOLS MATCHES "NO") if (CMAKE_C_COMPILER_ID STREQUAL "Intel") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-s") elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") -- cgit v0.12