diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 60 |
1 files changed, 51 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d9e6ee..4b97039 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ endif() # RelWithDebInfo : Release build with Debug Info # MinSizeRel : Release Min Size build IF(NOT CMAKE_BUILD_TYPE) - SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build Type" FORCE) + SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build Type" FORCE) ENDIF(NOT CMAKE_BUILD_TYPE) # Set a value type to properly display CMAKE_BUILD_TYPE on GUI if the # value type is "UNINITIALIZED". @@ -119,6 +119,20 @@ IF (CMAKE_C_COMPILER_ID MATCHES "^Clang$") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wmissing-prototypes") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wcast-qual") ENDIF (CMAKE_C_COMPILER_ID MATCHES "^Clang$") +IF (CMAKE_C_COMPILER_ID MATCHES "^XL$") + SET(CMAKE_C_COMPILER "xlc_r") + SET(CMAKE_REQUIRED_FLAGS "-qflag=e:e -qformat=sec") + ################################################################# + # Set compile flags for all build types. + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -qflag=e:e -qformat=sec") + ################################################################# + # Set compile flags for debug build. + # This is added into CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug" + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -qhalt=w") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -qflag=w:w") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -qinfo=pro:use") +ENDIF(CMAKE_C_COMPILER_ID MATCHES "^XL$") IF (MSVC) ################################################################# # Set compile flags for debug build. @@ -190,7 +204,7 @@ OPTION(ENABLE_INSTALL "Enable installing of libraries" ON) SET(POSIX_REGEX_LIB "AUTO" CACHE STRING "Choose what library should provide POSIX regular expression support") SET(ENABLE_SAFESEH "AUTO" CACHE STRING "Enable use of /SAFESEH linker flag (MSVC only)") -SET(WINDOWS_VERSION "" CACHE STRING "Set Windows version to use (Windows only)") +SET(WINDOWS_VERSION "WIN7" CACHE STRING "Set Windows version to use (Windows only)") IF(ENABLE_COVERAGE) include(LibarchiveCodeCoverage) @@ -202,22 +216,35 @@ ENDIF(ENABLE_TEST) IF(WIN32) IF(WINDOWS_VERSION STREQUAL "WIN8") + SET(NTDDI_VERSION 0x06020000) + SET(_WIN32_WINNT 0x0602) SET(WINVER 0x0602) ELSEIF(WINDOWS_VERSION STREQUAL "WIN7") + SET(NTDDI_VERSION 0x06010000) + SET(_WIN32_WINNT 0x0601) SET(WINVER 0x0601) ELSEIF(WINDOWS_VERSION STREQUAL "WS08") + SET(NTDDI_VERSION 0x06000100) + SET(_WIN32_WINNT 0x0600) SET(WINVER 0x0600) ELSEIF(WINDOWS_VERSION STREQUAL "VISTA") + SET(NTDDI_VERSION 0x06000000) + SET(_WIN32_WINNT 0x0600) SET(WINVER 0x0600) ELSEIF(WINDOWS_VERSION STREQUAL "WS03") + SET(NTDDI_VERSION 0x05020000) + SET(_WIN32_WINNT 0x0502) SET(WINVER 0x0502) ELSEIF(WINDOWS_VERSION STREQUAL "WINXP") + SET(NTDDI_VERSION 0x05010000) + SET(_WIN32_WINNT 0x0501) SET(WINVER 0x0501) ELSE(WINDOWS_VERSION STREQUAL "WIN8") - # The default is to use Windows 2000 API. - SET(WINVER 0x0500) + # Default to Windows Server 2003 API if we don't recognize the specifier + SET(NTDDI_VERSION 0x05020000) + SET(_WIN32_WINNT 0x0502) + SET(WINVER 0x0502) ENDIF(WINDOWS_VERSION STREQUAL "WIN8") - SET(_WIN32_WINNT ${WINVER}) ENDIF(WIN32) IF(MSVC) @@ -613,12 +640,17 @@ IF(ENABLE_NETTLE) FIND_PACKAGE(Nettle) IF(NETTLE_FOUND) SET(HAVE_LIBNETTLE 1) - SET(HAVE_NETTLE_MD5_H 1) - SET(HAVE_NETTLE_RIPEMD160_H 1) - SET(HAVE_NETTLE_SHA_H 1) - INCLUDE_DIRECTORIES(${NETTLE_INCLUDE_DIR}) LIST(APPEND ADDITIONAL_LIBS ${NETTLE_LIBRARIES}) + INCLUDE_DIRECTORIES(${NETTLE_INCLUDE_DIR}) + + LIST(APPEND CMAKE_REQUIRED_INCLUDES ${NETTLE_INCLUDE_DIR}) + LA_CHECK_INCLUDE_FILE("nettle/aes.h" HAVE_NETTLE_AES_H) + LA_CHECK_INCLUDE_FILE("nettle/hmac.h" HAVE_NETTLE_HMAC_H) + LA_CHECK_INCLUDE_FILE("nettle/md5.h" HAVE_NETTLE_MD5_H) LA_CHECK_INCLUDE_FILE("nettle/pbkdf2.h" HAVE_NETTLE_PBKDF2_H) + LA_CHECK_INCLUDE_FILE("nettle/ripemd160.h" HAVE_NETTLE_RIPEMD160_H) + LA_CHECK_INCLUDE_FILE("nettle/sha.h" HAVE_NETTLE_SHA_H) + ENDIF(NETTLE_FOUND) MARK_AS_ADVANCED(CLEAR NETTLE_INCLUDE_DIR) MARK_AS_ADVANCED(CLEAR NETTLE_LIBRARIES) @@ -632,6 +664,8 @@ IF(ENABLE_OPENSSL AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") FIND_PACKAGE(OpenSSL) IF(OPENSSL_FOUND) SET(HAVE_LIBCRYPTO 1) + INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${OPENSSL_CRYPTO_LIBRARY}) ENDIF(OPENSSL_FOUND) ELSE() SET(OPENSSL_FOUND FALSE) # Override cached value @@ -850,6 +884,9 @@ MACRO(CHECK_ICONV LIB TRY_ICONV_CONST) SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror") ENDIF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR CMAKE_C_COMPILER_ID MATCHES "^Clang$") + IF (CMAKE_C_COMPILER_ID MATCHES "^XL$") + SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -qhalt=w -qflag=w:w") + ENDIF (CMAKE_C_COMPILER_ID MATCHES "^XL$") IF (MSVC) # NOTE: /WX option is the same as gcc's -Werror option. SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} /WX") @@ -1279,10 +1316,15 @@ ENDIF(HAVE_INTTYPES_H) CHECK_SYMBOL_EXISTS(EFTYPE "errno.h" HAVE_EFTYPE) CHECK_SYMBOL_EXISTS(EILSEQ "errno.h" HAVE_EILSEQ) CHECK_SYMBOL_EXISTS(D_MD_ORDER "langinfo.h" HAVE_D_MD_ORDER) +CHECK_SYMBOL_EXISTS(INT32_MAX "${headers}" HAVE_DECL_INT32_MAX) +CHECK_SYMBOL_EXISTS(INT32_MIN "${headers}" HAVE_DECL_INT32_MIN) CHECK_SYMBOL_EXISTS(INT64_MAX "${headers}" HAVE_DECL_INT64_MAX) CHECK_SYMBOL_EXISTS(INT64_MIN "${headers}" HAVE_DECL_INT64_MIN) +CHECK_SYMBOL_EXISTS(INTMAX_MAX "${headers}" HAVE_DECL_INTMAX_MAX) +CHECK_SYMBOL_EXISTS(INTMAX_MIN "${headers}" HAVE_DECL_INTMAX_MIN) CHECK_SYMBOL_EXISTS(UINT32_MAX "${headers}" HAVE_DECL_UINT32_MAX) CHECK_SYMBOL_EXISTS(UINT64_MAX "${headers}" HAVE_DECL_UINT64_MAX) +CHECK_SYMBOL_EXISTS(UINTMAX_MAX "${headers}" HAVE_DECL_UINTMAX_MAX) CHECK_SYMBOL_EXISTS(SIZE_MAX "${headers}" HAVE_DECL_SIZE_MAX) CHECK_SYMBOL_EXISTS(SSIZE_MAX "limits.h" HAVE_DECL_SSIZE_MAX) |