summaryrefslogtreecommitdiffstats
path: root/config/cmake_ext_mod
diff options
context:
space:
mode:
Diffstat (limited to 'config/cmake_ext_mod')
-rw-r--r--config/cmake_ext_mod/CheckTypeSize.cmake61
-rw-r--r--config/cmake_ext_mod/ConfigureChecks.cmake28
-rw-r--r--config/cmake_ext_mod/HDFMacros.cmake88
-rw-r--r--config/cmake_ext_mod/HDFTests.c14
4 files changed, 113 insertions, 78 deletions
diff --git a/config/cmake_ext_mod/CheckTypeSize.cmake b/config/cmake_ext_mod/CheckTypeSize.cmake
deleted file mode 100644
index c14c2f2..0000000
--- a/config/cmake_ext_mod/CheckTypeSize.cmake
+++ /dev/null
@@ -1,61 +0,0 @@
-#
-# Copyright by The HDF Group.
-# All rights reserved.
-#
-# This file is part of HDF5. The full HDF5 copyright notice, including
-# terms governing use, modification, and redistribution, is contained in
-# the COPYING file, which can be found at the root of the source code
-# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
-# If you do not have access to either file, you may request a copy from
-# help@hdfgroup.org.
-#
-#
-# Check if the type exists and determine size of type. if the type
-# exists, the size will be stored to the variable.
-#
-# CHECK_TYPE_SIZE - macro which checks the size of type
-# VARIABLE - variable to store size if the type exists.
-# HAVE_${VARIABLE} - does the variable exists or not
-#
-
-macro (HDF_CHECK_TYPE_SIZE TYPE VARIABLE)
- set (CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS 1)
- if ("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$")
- set (MACRO_CHECK_TYPE_SIZE_FLAGS
- "-DCHECK_TYPE_SIZE_TYPE=\"${TYPE}\" ${CMAKE_REQUIRED_FLAGS}"
- )
- foreach (def HAVE_SYS_TYPES_H HAVE_STDINT_H HAVE_STDDEF_H HAVE_INTTYPES_H)
- if ("${def}")
- set (MACRO_CHECK_TYPE_SIZE_FLAGS "${MACRO_CHECK_TYPE_SIZE_FLAGS} -D${def}")
- endif ()
- endforeach ()
-
- message (STATUS "Check size of ${TYPE}")
- if (CMAKE_REQUIRED_LIBRARIES)
- set (CHECK_TYPE_SIZE_ADD_LIBRARIES
- "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}"
- )
- endif ()
- try_run (${VARIABLE} HAVE_${VARIABLE}
- ${CMAKE_BINARY_DIR}
- ${HDF_RESOURCES_EXT_DIR}/CheckTypeSize.c
- CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_TYPE_SIZE_FLAGS}
- "${CHECK_TYPE_SIZE_ADD_LIBRARIES}"
- OUTPUT_VARIABLE OUTPUT
- )
- if (HAVE_${VARIABLE})
- message (STATUS "Check size of ${TYPE} - done")
- file (APPEND
- ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log
- "Determining size of ${TYPE} passed with the following output:\n${OUTPUT}\n\n"
- )
- else ()
- message (STATUS "Check size of ${TYPE} - failed")
- file (APPEND
- ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
- "Determining size of ${TYPE} failed with the following output:\n${OUTPUT}\n\n"
- )
- endif ()
- endif ()
- set (CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS)
-endmacro ()
diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake
index 56d45f9..3797768 100644
--- a/config/cmake_ext_mod/ConfigureChecks.cmake
+++ b/config/cmake_ext_mod/ConfigureChecks.cmake
@@ -12,18 +12,18 @@
#-----------------------------------------------------------------------------
# Include all the necessary files for macros
#-----------------------------------------------------------------------------
-include (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake)
-include (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
-include (${CMAKE_ROOT}/Modules/CheckIncludeFileCXX.cmake)
-include (${CMAKE_ROOT}/Modules/CheckIncludeFiles.cmake)
-include (${CMAKE_ROOT}/Modules/CheckLibraryExists.cmake)
-include (${CMAKE_ROOT}/Modules/CheckSymbolExists.cmake)
-include (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake)
-include (${CMAKE_ROOT}/Modules/CheckVariableExists.cmake)
-include (${CMAKE_ROOT}/Modules/CheckFortranFunctionExists.cmake)
-include (${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
+include (CheckFunctionExists)
+include (CheckIncludeFile)
+include (CheckIncludeFileCXX)
+include (CheckIncludeFiles)
+include (CheckLibraryExists)
+include (CheckSymbolExists)
+include (CheckTypeSize)
+include (CheckVariableExists)
+include (CheckFortranFunctionExists)
+include (TestBigEndian)
if (CMAKE_CXX_COMPILER AND CMAKE_CXX_COMPILER_LOADED)
- include (${CMAKE_ROOT}/Modules/TestForSTDNamespace.cmake)
+ include (TestForSTDNamespace)
endif ()
#-----------------------------------------------------------------------------
@@ -145,7 +145,7 @@ endif ()
# For other specific tests, use this MACRO.
macro (HDF_FUNCTION_TEST OTHER_TEST)
- if ("${HDF_PREFIX}_${OTHER_TEST}" MATCHES "^${HDF_PREFIX}_${OTHER_TEST}$")
+ if (NOT DEFINED ${HDF_PREFIX}_${OTHER_TEST})
set (MACRO_CHECK_FUNCTION_DEFINITIONS "-D${OTHER_TEST} ${CMAKE_REQUIRED_FLAGS}")
set (OTHER_TEST_ADD_LIBRARIES)
if (CMAKE_REQUIRED_LIBRARIES)
@@ -587,7 +587,7 @@ endif ()
# For other CXX specific tests, use this MACRO.
macro (HDF_CXX_FUNCTION_TEST OTHER_TEST)
- if ("${OTHER_TEST}" MATCHES "^${OTHER_TEST}$")
+ if (NOT DEFINED ${OTHER_TEST})
set (MACRO_CHECK_FUNCTION_DEFINITIONS "-D${OTHER_TEST} ${CMAKE_REQUIRED_FLAGS}")
set (OTHER_TEST_ADD_LIBRARIES)
if (CMAKE_REQUIRED_LIBRARIES)
@@ -656,7 +656,7 @@ endif ()
if (WINDOWS)
if (NOT HDF_NO_IOEO_TEST)
message (STATUS "Checking for InitOnceExecuteOnce:")
- if ("${${HDF_PREFIX}_HAVE_IOEO}" MATCHES "^${${HDF_PREFIX}_HAVE_IOEO}$")
+ if (NOT DEFINED ${${HDF_PREFIX}_HAVE_IOEO})
if (LARGEFILE)
set (CMAKE_REQUIRED_DEFINITIONS
"${CURRENT_TEST_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE"
diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake
index 870ff5a..4097ca9 100644
--- a/config/cmake_ext_mod/HDFMacros.cmake
+++ b/config/cmake_ext_mod/HDFMacros.cmake
@@ -124,8 +124,8 @@ macro (HDF_SET_LIB_OPTIONS libtarget libname libtype)
set_target_properties (${libtarget}
PROPERTIES
-# OUTPUT_NAME
-# ${LIB_RELEASE_NAME}$<$<CONFIG:Debug>:${LIB_DEBUG_SUFFIX}>
+ OUTPUT_NAME
+ ${LIB_RELEASE_NAME}
OUTPUT_NAME_DEBUG
${LIB_DEBUG_NAME}
OUTPUT_NAME_RELEASE
@@ -166,7 +166,7 @@ macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion)
if (${importtype} MATCHES "IMPORT")
set (importprefix "${CMAKE_STATIC_LIBRARY_PREFIX}")
endif ()
- if (${HDF_CFG_NAME} MATCHES "Debug")
+ if (${CMAKE_BUILD_TYPE} MATCHES "Debug")
set (IMPORT_LIB_NAME ${LIB_DEBUG_NAME})
else ()
set (IMPORT_LIB_NAME ${LIB_RELEASE_NAME})
@@ -331,3 +331,85 @@ macro (HDFTEST_COPY_FILE src dest target)
)
list (APPEND ${target}_list "${dest}")
endmacro ()
+
+macro (HDF_DIR_PATHS package_prefix)
+ if (APPLE)
+ option (${package_prefix}_BUILD_FRAMEWORKS "TRUE to build as frameworks libraries, FALSE to build according to BUILD_SHARED_LIBS" FALSE)
+ endif ()
+
+ if (NOT ${package_prefix}_INSTALL_BIN_DIR)
+ set (${package_prefix}_INSTALL_BIN_DIR bin)
+ endif ()
+ if (NOT ${package_prefix}_INSTALL_LIB_DIR)
+ if (APPLE)
+ if (${package_prefix}_BUILD_FRAMEWORKS)
+ set (${package_prefix}_INSTALL_JAR_DIR ../Java)
+ else ()
+ set (${package_prefix}_INSTALL_JAR_DIR lib)
+ endif ()
+ set (${package_prefix}_INSTALL_FMWK_DIR ${CMAKE_INSTALL_FRAMEWORK_PREFIX})
+ else ()
+ set (${package_prefix}_INSTALL_JAR_DIR lib)
+ endif ()
+ set (${package_prefix}_INSTALL_LIB_DIR lib)
+ endif ()
+ if (NOT ${package_prefix}_INSTALL_INCLUDE_DIR)
+ set (${package_prefix}_INSTALL_INCLUDE_DIR include)
+ endif ()
+ if (NOT ${package_prefix}_INSTALL_DATA_DIR)
+ if (NOT WIN32)
+ if (APPLE)
+ if (${package_prefix}_BUILD_FRAMEWORKS)
+ set (${package_prefix}_INSTALL_EXTRA_DIR ../SharedSupport)
+ else ()
+ set (${package_prefix}_INSTALL_EXTRA_DIR share)
+ endif ()
+ set (${package_prefix}_INSTALL_FWRK_DIR ${CMAKE_INSTALL_FRAMEWORK_PREFIX})
+ endif ()
+ set (${package_prefix}_INSTALL_DATA_DIR share)
+ set (${package_prefix}_INSTALL_CMAKE_DIR share/cmake)
+ else ()
+ set (${package_prefix}_INSTALL_DATA_DIR ".")
+ set (${package_prefix}_INSTALL_CMAKE_DIR cmake)
+ endif ()
+ endif ()
+
+ if (DEFINED ADDITIONAL_CMAKE_PREFIX_PATH AND EXISTS "${ADDITIONAL_CMAKE_PREFIX_PATH}")
+ set (CMAKE_PREFIX_PATH ${ADDITIONAL_CMAKE_PREFIX_PATH} ${CMAKE_PREFIX_PATH})
+ endif ()
+
+ SET_HDF_BUILD_TYPE()
+
+#-----------------------------------------------------------------------------
+# Setup output Directories
+#-----------------------------------------------------------------------------
+ if (NOT ${package_prefix}_EXTERNALLY_CONFIGURED)
+ set (CMAKE_RUNTIME_OUTPUT_DIRECTORY
+ ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all Executables."
+ )
+ set (CMAKE_LIBRARY_OUTPUT_DIRECTORY
+ ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all Libraries"
+ )
+ set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY
+ ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all static libraries."
+ )
+ set (CMAKE_Fortran_MODULE_DIRECTORY
+ ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all fortran modules."
+ )
+ if (WIN32)
+ set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CTEST_CONFIGURATION_TYPE})
+ set (CMAKE_PDB_OUTPUT_DIRECTORY
+ ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all pdb files."
+ )
+ else ()
+ set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CTEST_CONFIGURATION_TYPE})
+ endif ()
+ else ()
+ # if we are externally configured, but the project uses old cmake scripts
+ # this may not be set and utilities like H5detect will fail
+ if (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
+ set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
+ endif ()
+ endif ()
+endmacro ()
+
diff --git a/config/cmake_ext_mod/HDFTests.c b/config/cmake_ext_mod/HDFTests.c
index 60ac744..320fd5b 100644
--- a/config/cmake_ext_mod/HDFTests.c
+++ b/config/cmake_ext_mod/HDFTests.c
@@ -222,12 +222,26 @@ SIMPLE_TEST(struct stat sb; sb.st_blocks=0);
#include <stdlib.h>
#include <string.h>
+#if defined(_MSC_VER) && defined(_DEBUG)
+# include <crtdbg.h>
+int DebugReport(int reportType, char* message, int* returnValue)
+{
+ (void)reportType;
+ (void)message;
+ (void)returnValue;
+ return 1; /* no further handling required */
+}
+#endif
+
int main(void)
{
char *llwidthArgs[] = { "I64", "l64", "l", "L", "q", "ll", NULL };
char *s = malloc(128);
char **currentArg = NULL;
LL_TYPE x = (LL_TYPE)1048576 * (LL_TYPE)1048576;
+ #if defined(_MSC_VER) && defined(_DEBUG)
+ _CrtSetReportHook(DebugReport);
+ #endif
for (currentArg = llwidthArgs; *currentArg != NULL; currentArg++)
{
char formatString[64];