diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2011-11-22 18:40:38 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2011-11-22 18:40:38 (GMT) |
commit | 3be9358e0b21d0967dfc1e43af4d600bede95db7 (patch) | |
tree | 1ede18da90116b6989c86675f6e90b456207a482 /config/cmake | |
parent | 0213b3b435410d116824f34e4e9ec4051a305bbc (diff) | |
download | hdf5-3be9358e0b21d0967dfc1e43af4d600bede95db7.zip hdf5-3be9358e0b21d0967dfc1e43af4d600bede95db7.tar.gz hdf5-3be9358e0b21d0967dfc1e43af4d600bede95db7.tar.bz2 |
[svn-r21773] Correctly use CMAKE_BUILD_TYPE in functions for building extrnal libraries.
Tested: local linux
Diffstat (limited to 'config/cmake')
-rw-r--r-- | config/cmake/HDFMacros.cmake | 107 |
1 files changed, 66 insertions, 41 deletions
diff --git a/config/cmake/HDFMacros.cmake b/config/cmake/HDFMacros.cmake index d864e84..b0a6dfc 100644 --- a/config/cmake/HDFMacros.cmake +++ b/config/cmake/HDFMacros.cmake @@ -16,6 +16,7 @@ MACRO (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) CMAKE_ARGS -DBUILD_SHARED_LIBS:BOOL=OFF -DJPEG_EXTERNALLY_CONFIGURED:BOOL=OFF + -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} @@ -30,6 +31,7 @@ MACRO (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) CMAKE_ARGS -DBUILD_SHARED_LIBS:BOOL=OFF -DJPEG_EXTERNALLY_CONFIGURED:BOOL=OFF + -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} @@ -39,31 +41,46 @@ MACRO (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) ENDIF (${compress_type} MATCHES "SVN") EXTERNALPROJECT_GET_PROPERTY (JPEG BINARY_DIR SOURCE_DIR) - IF (${BLDTYPE} MATCHES "Debug") + IF (${CMAKE_BUILD_TYPE} MATCHES "DEBUG") IF (WIN32 AND NOT MINGW) - SET (DBG_EXT "_D") + SET (JPEG_LIB_NAME "jpeg_D") ELSE (WIN32 AND NOT MINGW) - SET (DBG_EXT "_debug") + SET (JPEG_LIB_NAME "jpeg_debug") ENDIF (WIN32 AND NOT MINGW) - ELSE (${BLDTYPE} MATCHES "Debug") - SET (DBG_EXT "") - ENDIF (${BLDTYPE} MATCHES "Debug") + ELSE (${CMAKE_BUILD_TYPE} MATCHES "DEBUG") + SET (JPEG_LIB_NAME "jpeg") + ENDIF (${CMAKE_BUILD_TYPE} MATCHES "DEBUG") # Create imported target szip ADD_LIBRARY(jpeg STATIC IMPORTED) ADD_DEPENDENCIES (jpeg JPEG) - IF (WIN32 AND NOT MINGW) - SET_TARGET_PROPERTIES(jpeg PROPERTIES - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${BLDTYPE}/libjpeg${DBG_EXT}${CMAKE_STATIC_LIBRARY_SUFFIX}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - ) - ELSE (WIN32 AND NOT MINGW) - SET_TARGET_PROPERTIES(jpeg PROPERTIES - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libjpeg${DBG_EXT}${CMAKE_STATIC_LIBRARY_SUFFIX}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - ) - ENDIF (WIN32 AND NOT MINGW) + IF (${libtype} MATCHES "SHARED") + IF (WIN32 AND NOT MINGW) + SET_TARGET_PROPERTIES(jpeg PROPERTIES + IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${BLDTYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${JPEG_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}" + IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${BLDTYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${JPEG_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" + ) + ELSE (WIN32 AND NOT MINGW) + SET_TARGET_PROPERTIES(jpeg PROPERTIES + IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}${JPEG_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" + IMPORTED_SONAME "${CMAKE_SHARED_LIBRARY_PREFIX}${JPEG_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}.2.1" + SOVERSION "2.1" + ) + ENDIF (WIN32 AND NOT MINGW) + ELSE (${libtype} MATCHES "SHARED") + IF (WIN32 AND NOT MINGW) + SET_TARGET_PROPERTIES(jpeg PROPERTIES + IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${BLDTYPE}/lib${JPEG_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + ) + ELSE (WIN32 AND NOT MINGW) + SET_TARGET_PROPERTIES(jpeg PROPERTIES + IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/lib${JPEG_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + ) + ENDIF (WIN32 AND NOT MINGW) + ENDIF (${libtype} MATCHES "SHARED") # INCLUDE (${BINARY_DIR}/JPEG-targets.cmake) SET (JPEG_LIBRARY "jpeg") @@ -97,6 +114,7 @@ MACRO (EXTERNAL_SZIP_LIBRARY compress_type libtype encoding) CMAKE_ARGS -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} -DSZIP_EXTERNALLY_CONFIGURED:BOOL=OFF + -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} @@ -111,6 +129,7 @@ MACRO (EXTERNAL_SZIP_LIBRARY compress_type libtype encoding) CMAKE_ARGS -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} -DSZIP_EXTERNALLY_CONFIGURED:BOOL=OFF + -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} @@ -120,15 +139,15 @@ MACRO (EXTERNAL_SZIP_LIBRARY compress_type libtype encoding) ENDIF (${compress_type} MATCHES "SVN") EXTERNALPROJECT_GET_PROPERTY (SZIP BINARY_DIR SOURCE_DIR) - IF (${BLDTYPE} MATCHES "Debug") + IF (${CMAKE_BUILD_TYPE} MATCHES "DEBUG") IF (WIN32 AND NOT MINGW) - SET (DBG_EXT "_D") + SET (SZIP_LIB_NAME "szip_D") ELSE (WIN32 AND NOT MINGW) - SET (DBG_EXT "_debug") + SET (SZIP_LIB_NAME "szip_debug") ENDIF (WIN32 AND NOT MINGW) - ELSE (${BLDTYPE} MATCHES "Debug") - SET (DBG_EXT "") - ENDIF (${BLDTYPE} MATCHES "Debug") + ELSE (${CMAKE_BUILD_TYPE} MATCHES "DEBUG") + SET (SZIP_LIB_NAME "szip") + ENDIF (${CMAKE_BUILD_TYPE} MATCHES "DEBUG") # Create imported target szip ADD_LIBRARY(szip ${libtype} IMPORTED) @@ -137,25 +156,25 @@ MACRO (EXTERNAL_SZIP_LIBRARY compress_type libtype encoding) IF (${libtype} MATCHES "SHARED") IF (WIN32 AND NOT MINGW) SET_TARGET_PROPERTIES(szip PROPERTIES - IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${BLDTYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}szip${DBG_EXT}${CMAKE_IMPORT_LIBRARY_SUFFIX}" - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${BLDTYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}szip${DBG_EXT}${CMAKE_SHARED_LIBRARY_SUFFIX}" + IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${BLDTYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${SZIP_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}" + IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${BLDTYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${SZIP_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) ELSE (WIN32 AND NOT MINGW) SET_TARGET_PROPERTIES(szip PROPERTIES - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}szip${DBG_EXT}${CMAKE_SHARED_LIBRARY_SUFFIX}" - IMPORTED_SONAME "${CMAKE_SHARED_LIBRARY_PREFIX}szip${DBG_EXT}${CMAKE_SHARED_LIBRARY_SUFFIX}.2.1" + IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}${SZIP_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" + IMPORTED_SONAME "${CMAKE_SHARED_LIBRARY_PREFIX}${SZIP_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}.2.1" SOVERSION "2.1" ) ENDIF (WIN32 AND NOT MINGW) ELSE (${libtype} MATCHES "SHARED") IF (WIN32 AND NOT MINGW) SET_TARGET_PROPERTIES(szip PROPERTIES - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${BLDTYPE}/libszip${DBG_EXT}${CMAKE_STATIC_LIBRARY_SUFFIX}" + IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${BLDTYPE}/lib${SZIP_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" IMPORTED_LINK_INTERFACE_LANGUAGES "C" ) ELSE (WIN32 AND NOT MINGW) SET_TARGET_PROPERTIES(szip PROPERTIES - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libszip${DBG_EXT}${CMAKE_STATIC_LIBRARY_SUFFIX}" + IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/lib${SZIP_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" IMPORTED_LINK_INTERFACE_LANGUAGES "C" ) ENDIF (WIN32 AND NOT MINGW) @@ -193,6 +212,7 @@ MACRO (EXTERNAL_ZLIB_LIBRARY compress_type libtype) CMAKE_ARGS -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} -DZLIB_EXTERNALLY_CONFIGURED:BOOL=OFF + -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} @@ -207,6 +227,7 @@ MACRO (EXTERNAL_ZLIB_LIBRARY compress_type libtype) CMAKE_ARGS -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} -DZLIB_EXTERNALLY_CONFIGURED:BOOL=OFF + -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} @@ -216,15 +237,19 @@ MACRO (EXTERNAL_ZLIB_LIBRARY compress_type libtype) ENDIF (${compress_type} MATCHES "SVN") EXTERNALPROJECT_GET_PROPERTY (ZLIB BINARY_DIR SOURCE_DIR) - IF (${BLDTYPE} MATCHES "Debug") + IF (${CMAKE_BUILD_TYPE} MATCHES "DEBUG") + IF (WIN32 AND NOT MINGW) + SET (ZLIB_LIB_NAME "zlib_D") + ELSE (WIN32 AND NOT MINGW) + SET (ZLIB_LIB_NAME "z_debug") + ENDIF (WIN32 AND NOT MINGW) + ELSE (${CMAKE_BUILD_TYPE} MATCHES "DEBUG") IF (WIN32 AND NOT MINGW) - SET (DBG_EXT "_D") + SET (ZLIB_LIB_NAME "zlib") ELSE (WIN32 AND NOT MINGW) - SET (DBG_EXT "_debug") + SET (ZLIB_LIB_NAME "z") ENDIF (WIN32 AND NOT MINGW) - ELSE (${BLDTYPE} MATCHES "Debug") - SET (DBG_EXT "") - ENDIF (${BLDTYPE} MATCHES "Debug") + ENDIF (${CMAKE_BUILD_TYPE} MATCHES "DEBUG") # Create imported target szip ADD_LIBRARY(zlib ${libtype} IMPORTED) @@ -233,25 +258,25 @@ MACRO (EXTERNAL_ZLIB_LIBRARY compress_type libtype) IF (${libtype} MATCHES "SHARED") IF (WIN32 AND NOT MINGW) SET_TARGET_PROPERTIES(zlib PROPERTIES - IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${BLDTYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}zlib${DBG_EXT}${CMAKE_IMPORT_LIBRARY_SUFFIX}" - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${BLDTYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}zlib${DBG_EXT}${CMAKE_SHARED_LIBRARY_SUFFIX}" + IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${BLDTYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${ZLIB_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}" + IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${BLDTYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${ZLIB_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) ELSE (WIN32 AND NOT MINGW) SET_TARGET_PROPERTIES(zlib PROPERTIES - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}z${DBG_EXT}${CMAKE_SHARED_LIBRARY_SUFFIX}" - IMPORTED_SONAME "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}z${DBG_EXT}${CMAKE_SHARED_LIBRARY_SUFFIX}.1.2" + IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}${ZLIB_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" + IMPORTED_SONAME "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}${ZLIB_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}.1.2" SOVERSION "1.2" ) ENDIF (WIN32 AND NOT MINGW) ELSE (${libtype} MATCHES "SHARED") IF (WIN32 AND NOT MINGW) SET_TARGET_PROPERTIES(zlib PROPERTIES - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${BLDTYPE}/libzlib${DBG_EXT}${CMAKE_STATIC_LIBRARY_SUFFIX}" + IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${BLDTYPE}/lib${ZLIB_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" IMPORTED_LINK_INTERFACE_LANGUAGES "C" ) ELSE (WIN32 AND NOT MINGW) SET_TARGET_PROPERTIES(zlib PROPERTIES - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libz${DBG_EXT}${CMAKE_STATIC_LIBRARY_SUFFIX}" + IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/lib${ZLIB_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" IMPORTED_LINK_INTERFACE_LANGUAGES "C" ) ENDIF (WIN32 AND NOT MINGW) |