[svn-r21772] Correctly use CMAKE_BUILD_TYPE in functions for building extrnal libraries.

Tested: local linux
This commit is contained in:
Allen Byrne 2011-11-22 13:15:34 -05:00
parent cf472f86fc
commit 88dc9b36d8

View File

@ -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 (${libtype} MATCHES "SHARED")
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_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}/libjpeg${DBG_EXT}${CMAKE_STATIC_LIBRARY_SUFFIX}"
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 (DBG_EXT "_D")
SET (ZLIB_LIB_NAME "zlib_D")
ELSE (WIN32 AND NOT MINGW)
SET (DBG_EXT "_debug")
SET (ZLIB_LIB_NAME "z_debug")
ENDIF (WIN32 AND NOT MINGW)
ELSE (${BLDTYPE} MATCHES "Debug")
SET (DBG_EXT "")
ENDIF (${BLDTYPE} MATCHES "Debug")
ELSE (${CMAKE_BUILD_TYPE} MATCHES "DEBUG")
IF (WIN32 AND NOT MINGW)
SET (ZLIB_LIB_NAME "zlib")
ELSE (WIN32 AND NOT MINGW)
SET (ZLIB_LIB_NAME "z")
ENDIF (WIN32 AND NOT MINGW)
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)