summaryrefslogtreecommitdiffstats
path: root/config/cmake_ext_mod/HDFMacros.cmake
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2022-11-05 19:47:02 (GMT)
committerGitHub <noreply@github.com>2022-11-05 19:47:02 (GMT)
commite1673be0efa4a4549727bc03db4b719f4e280ad6 (patch)
treea53a04f04dd334f9712d03b1576e72fbf72adc10 /config/cmake_ext_mod/HDFMacros.cmake
parent559d7d056be22fb9e2f0da69168c9050d448a71c (diff)
downloadhdf5-e1673be0efa4a4549727bc03db4b719f4e280ad6.zip
hdf5-e1673be0efa4a4549727bc03db4b719f4e280ad6.tar.gz
hdf5-e1673be0efa4a4549727bc03db4b719f4e280ad6.tar.bz2
1.10 Merge HDFGroup#2175 Implement option for using CMake GNUInstallDirs (#2222)
Diffstat (limited to 'config/cmake_ext_mod/HDFMacros.cmake')
-rw-r--r--config/cmake_ext_mod/HDFMacros.cmake86
1 files changed, 60 insertions, 26 deletions
diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake
index 6f517bd..863b7ba 100644
--- a/config/cmake_ext_mod/HDFMacros.cmake
+++ b/config/cmake_ext_mod/HDFMacros.cmake
@@ -12,30 +12,30 @@
#-------------------------------------------------------------------------------
macro (SET_HDF_BUILD_TYPE)
- get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
- if(_isMultiConfig)
- set(HDF_CFG_NAME ${CMAKE_BUILD_TYPE})
- set(HDF_BUILD_TYPE ${CMAKE_CFG_INTDIR})
- set(HDF_CFG_BUILD_TYPE \${CMAKE_INSTALL_CONFIG_NAME})
- else()
- set(HDF_CFG_BUILD_TYPE ".")
- if(CMAKE_BUILD_TYPE)
- set(HDF_CFG_NAME ${CMAKE_BUILD_TYPE})
- set(HDF_BUILD_TYPE ${CMAKE_BUILD_TYPE})
- else()
- set(HDF_CFG_NAME "Release")
- set(HDF_BUILD_TYPE "Release")
- endif()
- endif()
- if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
+ get_property (_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+ if (_isMultiConfig)
+ set (HDF_CFG_NAME ${CMAKE_BUILD_TYPE})
+ set (HDF_BUILD_TYPE ${CMAKE_CFG_INTDIR})
+ set (HDF_CFG_BUILD_TYPE \${CMAKE_INSTALL_CONFIG_NAME})
+ else ()
+ set (HDF_CFG_BUILD_TYPE ".")
+ if (CMAKE_BUILD_TYPE)
+ set (HDF_CFG_NAME ${CMAKE_BUILD_TYPE})
+ set (HDF_BUILD_TYPE ${CMAKE_BUILD_TYPE})
+ else ()
+ set (HDF_CFG_NAME "Release")
+ set (HDF_BUILD_TYPE "Release")
+ endif ()
+ endif ()
+ if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0")
message (VERBOSE "Setting build type to 'RelWithDebInfo' as none was specified.")
endif()
- set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
+ set (CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
- set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
+ set_property (CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
"MinSizeRel" "RelWithDebInfo")
- endif()
+ endif ()
endmacro ()
#-------------------------------------------------------------------------------
@@ -45,7 +45,7 @@ endmacro ()
#-------------------------------------------------------------------------------
macro (IDE_GENERATED_PROPERTIES SOURCE_PATH HEADERS SOURCES)
- #set(source_group_path "Source/AIM/${NAME}")
+ #set (source_group_path "Source/AIM/${NAME}")
string (REPLACE "/" "\\\\" source_group_path ${SOURCE_PATH})
source_group (${source_group_path} FILES ${HEADERS} ${SOURCES})
@@ -321,6 +321,36 @@ macro (HDFTEST_COPY_FILE src dest target)
endmacro ()
macro (HDF_DIR_PATHS package_prefix)
+ option (HDF5_USE_GNU_DIRS "TRUE to use GNU Coding Standard install directory variables, FALSE to use historical settings" FALSE)
+ if (HDF5_USE_GNU_DIRS)
+ include(GNUInstallDirs)
+ if (NOT ${package_prefix}_INSTALL_BIN_DIR)
+ set (${package_prefix}_INSTALL_BIN_DIR ${CMAKE_INSTALL_BINDIR})
+ endif ()
+ if (NOT ${package_prefix}_INSTALL_LIB_DIR)
+ set (${package_prefix}_INSTALL_LIB_DIR ${CMAKE_INSTALL_LIBDIR})
+ endif ()
+ if (NOT ${package_prefix}_INSTALL_JAR_DIR)
+ set (${package_prefix}_INSTALL_JAR_DIR ${CMAKE_INSTALL_LIBDIR})
+ endif ()
+ if (NOT ${package_prefix}_INSTALL_INCLUDE_DIR)
+ set (${package_prefix}_INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_INCLUDEDIR})
+ endif ()
+ if (NOT ${package_prefix}_INSTALL_MODULE_DIR)
+ set (${package_prefix}_INSTALL_MODULE_DIR ${CMAKE_INSTALL_INCLUDEDIR}/mod)
+ endif ()
+ if (NOT ${package_prefix}_INSTALL_DATA_DIR)
+ set (${package_prefix}_INSTALL_DATA_DIR ${CMAKE_INSTALL_DATADIR})
+ endif ()
+ if (NOT ${package_prefix}_INSTALL_CMAKE_DIR)
+ set (${package_prefix}_INSTALL_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake)
+ endif ()
+ if (NOT ${package_prefix}_INSTALL_DOC_DIR)
+ set (${package_prefix}_INSTALL_DOC_DIR ${CMAKE_INSTALL_DOCDIR})
+ endif ()
+ message(STATUS "GNU: ${${package_prefix}_INSTALL_DOC_DIR}")
+ endif ()
+
if (APPLE)
option (${package_prefix}_BUILD_FRAMEWORKS "TRUE to build as frameworks libraries, FALSE to build according to BUILD_SHARED_LIBS" FALSE)
endif ()
@@ -365,6 +395,10 @@ macro (HDF_DIR_PATHS package_prefix)
if (NOT ${package_prefix}_INSTALL_CMAKE_DIR)
set (${package_prefix}_INSTALL_CMAKE_DIR cmake)
endif ()
+ if (NOT ${package_prefix}_INSTALL_DOC_DIR)
+ set (${package_prefix}_INSTALL_DOC_DIR ${${package_prefix}_INSTALL_DATA_DIR})
+ endif ()
+ message(STATUS "Final: ${${package_prefix}_INSTALL_DOC_DIR}")
# Always use full RPATH, i.e. don't skip the full RPATH for the build tree
set (CMAKE_SKIP_BUILD_RPATH FALSE)
@@ -391,12 +425,12 @@ macro (HDF_DIR_PATHS package_prefix)
endif ()
#set the default debug suffix for all library targets
- if(NOT CMAKE_DEBUG_POSTFIX)
- if (WIN32)
- set (CMAKE_DEBUG_POSTFIX "_D")
- else ()
- set (CMAKE_DEBUG_POSTFIX "_debug")
- endif ()
+ if(NOT CMAKE_DEBUG_POSTFIX)
+ if (WIN32)
+ set (CMAKE_DEBUG_POSTFIX "_D")
+ else ()
+ set (CMAKE_DEBUG_POSTFIX "_debug")
+ endif ()
endif ()
SET_HDF_BUILD_TYPE()