diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 7b4600c77a..c904c85509 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -62,6 +62,10 @@ endif() OPTION(USERSPACE_PYTHON_PREFIX "Installs IfcPython for the current user only instead of system-wide." OFF) OPTION(ADD_COMMIT_SHA "Add commit sha and branch in version number, warning results in many rebuilds, requires git" OFF) +IF(NOT CMAKE_BUILD_TYPE) + SET(CMAKE_BUILD_TYPE "Release") +ENDIF() + # TODO QtViewer is deprecated ATM as it uses the 0.4 API # OPTION(BUILD_QTVIEWER "Build IfcOpenShell Qt GUI Viewer (requires Qt 4 framework)." OFF) include(GNUInstallDirs) @@ -444,13 +448,17 @@ if(HDF5_SUPPORT) else() set(lib_ext a) endif() + + if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") + set(debug_postfix "_debug") + endif() SET(HDF5_LIBRARIES - "${HDF5_LIBRARY_DIR}/libhdf5_cpp.${lib_ext}" - "${HDF5_LIBRARY_DIR}/libhdf5.${lib_ext}" - "${HDF5_LIBRARY_DIR}/libz${zlib_post}.${lib_ext}" - "${HDF5_LIBRARY_DIR}/libsz.${lib_ext}" - "${HDF5_LIBRARY_DIR}/libaec.${lib_ext}" + "${HDF5_LIBRARY_DIR}/libhdf5_cpp${debug_postfix}.${lib_ext}" + "${HDF5_LIBRARY_DIR}/libhdf5${debug_postfix}.${lib_ext}" + "${HDF5_LIBRARY_DIR}/libz${zlib_post}${debug_postfix}.${lib_ext}" + "${HDF5_LIBRARY_DIR}/libsz${debug_postfix}.${lib_ext}" + "${HDF5_LIBRARY_DIR}/libaec${debug_postfix}.${lib_ext}" ) endif() @@ -470,10 +478,6 @@ if(HDF5_SUPPORT) set(SWIG_DEFINES ${SWIG_DEFINES} -DWITH_HDF5) endif() -IF(NOT CMAKE_BUILD_TYPE) - SET(CMAKE_BUILD_TYPE "Release") -ENDIF() - if(ENABLE_BUILD_OPTIMIZATIONS) if(MSVC) # NOTE: RelWithDebInfo and Release use O2 (= /Ox /Gl /Gy/ = Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy) by default,