diff --git a/CMake/3rdparty.cmake b/CMake/3rdparty.cmake index f273a5341b..22a0f706c4 100644 --- a/CMake/3rdparty.cmake +++ b/CMake/3rdparty.cmake @@ -1,340 +1,340 @@ -IF(WIN32 AND NOT MINGW) +if(WIN32 AND NOT MINGW) # For Windows, we don't used FIND_PACKAGE because DCMTK usually is used with its # own set of 3rd-party support libraries that can be downloaded from DCMTK's # website (pre-built). # libxml support: find out whether user has library - FILE(GLOB LIBXML_DIR "${DCMTK_SOURCE_DIR}/../libxml2*") - FIND_PATH(WITH_LIBXMLINC "/include/libxml/parser.h" "${LIBXML_DIR}" NO_DEFAULT_PATH) + file(GLOB LIBXML_DIR "${DCMTK_SOURCE_DIR}/../libxml2*") + find_path(WITH_LIBXMLINC "/include/libxml/parser.h" "${LIBXML_DIR}" NO_DEFAULT_PATH) # libpng support: find out whether user has library - FILE(GLOB LIBPNG_DIR "${DCMTK_SOURCE_DIR}/../libpng*") - FIND_PATH(WITH_LIBPNGINC "include/png.h" "${LIBPNG_DIR}" NO_DEFAULT_PATH) + file(GLOB LIBPNG_DIR "${DCMTK_SOURCE_DIR}/../libpng*") + find_path(WITH_LIBPNGINC "include/png.h" "${LIBPNG_DIR}" NO_DEFAULT_PATH) # libtiff support: find out whether user has library - FILE(GLOB LIBTIFF_DIR "${DCMTK_SOURCE_DIR}/../libtiff*") - FIND_PATH(WITH_LIBTIFFINC "include/tiff.h" "${LIBTIFF_DIR}" NO_DEFAULT_PATH) + file(GLOB LIBTIFF_DIR "${DCMTK_SOURCE_DIR}/../libtiff*") + find_path(WITH_LIBTIFFINC "include/tiff.h" "${LIBTIFF_DIR}" NO_DEFAULT_PATH) # OpenSSL support: find out whether user has library - FILE(GLOB OPENSSL_DIR "${DCMTK_SOURCE_DIR}/../openssl*") - FIND_PATH(WITH_OPENSSLINC "include/openssl/ssl.h" "${OPENSSL_DIR}" NO_DEFAULT_PATH) + file(GLOB OPENSSL_DIR "${DCMTK_SOURCE_DIR}/../openssl*") + find_path(WITH_OPENSSLINC "include/openssl/ssl.h" "${OPENSSL_DIR}" NO_DEFAULT_PATH) # zlib support: find out whether user has library - FILE(GLOB ZLIB_DIR "${DCMTK_SOURCE_DIR}/../zlib*") - FIND_PATH(WITH_ZLIBINC "include/zlib.h" "${ZLIB_DIR}" NO_DEFAULT_PATH) + file(GLOB ZLIB_DIR "${DCMTK_SOURCE_DIR}/../zlib*") + find_path(WITH_ZLIBINC "include/zlib.h" "${ZLIB_DIR}" NO_DEFAULT_PATH) # sndfile support: find out whether user has library. Needed for module dcmwave (not in public DCMTK yet, marked as advanced) - FILE(GLOB SNDFILE_DIR "${DCMTK_SOURCE_DIR}/../libsndfile*") - FIND_PATH(WITH_SNDFILEINC "sndfile.h" "${SNDFILE_DIR}" NO_DEFAULT_PATH) - MARK_AS_ADVANCED(SNDFILE_DIR WITH_SNDFILEINC) + file(GLOB SNDFILE_DIR "${DCMTK_SOURCE_DIR}/../libsndfile*") + find_path(WITH_SNDFILEINC "sndfile.h" "${SNDFILE_DIR}" NO_DEFAULT_PATH) + mark_as_advanced(SNDFILE_DIR WITH_SNDFILEINC) # libiconv support: find out whether user has library - FILE(GLOB LIBICONV_DIR "${DCMTK_SOURCE_DIR}/../libiconv*") - FIND_PATH(WITH_LIBICONVINC "include/iconv.h" "${LIBICONV_DIR}" NO_DEFAULT_PATH) + file(GLOB LIBICONV_DIR "${DCMTK_SOURCE_DIR}/../libiconv*") + find_path(WITH_LIBICONVINC "include/iconv.h" "${LIBICONV_DIR}" NO_DEFAULT_PATH) # libxml support: configure compiler - IF(DCMTK_WITH_XML) - IF(WITH_LIBXMLINC) - SET(LIBXML_INCDIR "${WITH_LIBXMLINC}/include") - SET(LIBXML_LIBDIR "${WITH_LIBXMLINC}/lib") - SET(LIBXML_LIBS debug "${LIBXML_LIBDIR}/libxml2_d.lib" optimized "${LIBXML_LIBDIR}/libxml2_o.lib" debug "${LIBXML_LIBDIR}/iconv_d.lib" optimized "${LIBXML_LIBDIR}/iconv_o.lib") - MESSAGE(STATUS "Info: DCMTK XML support will be enabled") - SET(WITH_LIBXML 1) + if(DCMTK_WITH_XML) + if(WITH_LIBXMLINC) + set(LIBXML_INCDIR "${WITH_LIBXMLINC}/include") + set(LIBXML_LIBDIR "${WITH_LIBXMLINC}/lib") + set(LIBXML_LIBS debug "${LIBXML_LIBDIR}/libxml2_d.lib" optimized "${LIBXML_LIBDIR}/libxml2_o.lib" debug "${LIBXML_LIBDIR}/iconv_d.lib" optimized "${LIBXML_LIBDIR}/iconv_o.lib") + message(STATUS "Info: DCMTK XML support will be enabled") + set(WITH_LIBXML 1) # this hides some warnings that are emitted when linking against libxmlXXX.lib instead of linking the DLL directly - ADD_DEFINITIONS("-DLIBXML_STATIC") - ELSE(WITH_LIBXMLINC) # turn off library if library path not set - MESSAGE(STATUS "Warning: XML support will be disabled because libxml2 directory is not specified. Correct path and re-enable DCMTK_WITH_XML.") - SET(DCMTK_WITH_XML OFF CACHE BOOL "" FORCE) - SET(WITH_LIBXML "") - ENDIF(WITH_LIBXMLINC) - ENDIF(DCMTK_WITH_XML) + add_definitions("-DLIBXML_STATIC") + else() # turn off library if library path not set + message(STATUS "Warning: XML support will be disabled because libxml2 directory is not specified. Correct path and re-enable DCMTK_WITH_XML.") + set(DCMTK_WITH_XML OFF CACHE BOOL "" FORCE) + set(WITH_LIBXML "") + endif() + endif() # libpng support: configure compiler - IF(DCMTK_WITH_PNG) - IF(WITH_LIBPNGINC) - SET(LIBPNG_INCDIR "${WITH_LIBPNGINC}/include") - SET(LIBPNG_LIBDIR "${WITH_LIBPNGINC}/lib") - SET(LIBPNG_LIBS debug "${LIBPNG_LIBDIR}/libpng_d.lib" optimized "${LIBPNG_LIBDIR}/libpng_o.lib") - MESSAGE(STATUS "Info: DCMTK PNG support will be enabled") - SET(WITH_LIBPNG 1) - ELSE(WITH_LIBPNGINC) # turn off library if library path not set - MESSAGE(STATUS "Warning: PNG support will be disabled because libpng directory was not specified. Correct path and re-enable DCMTK_WITH_PNG.") - SET(DCMTK_WITH_PNG OFF CACHE BOOL "" FORCE) - SET(WITH_LIBPNG "") - ENDIF(WITH_LIBPNGINC) - ENDIF(DCMTK_WITH_PNG) + if(DCMTK_WITH_PNG) + if(WITH_LIBPNGINC) + set(LIBPNG_INCDIR "${WITH_LIBPNGINC}/include") + set(LIBPNG_LIBDIR "${WITH_LIBPNGINC}/lib") + set(LIBPNG_LIBS debug "${LIBPNG_LIBDIR}/libpng_d.lib" optimized "${LIBPNG_LIBDIR}/libpng_o.lib") + message(STATUS "Info: DCMTK PNG support will be enabled") + set(WITH_LIBPNG 1) + else() # turn off library if library path not set + message(STATUS "Warning: PNG support will be disabled because libpng directory was not specified. Correct path and re-enable DCMTK_WITH_PNG.") + set(DCMTK_WITH_PNG OFF CACHE BOOL "" FORCE) + set(WITH_LIBPNG "") + endif() + endif() # libtiff support: configure compiler - IF(DCMTK_WITH_TIFF) - IF(WITH_LIBTIFFINC) - SET(LIBTIFF_INCDIR "${WITH_LIBTIFFINC}/include") - SET(LIBTIFF_LIBDIR "${WITH_LIBTIFFINC}/lib") - SET(LIBTIFF_LIBS debug "${LIBTIFF_LIBDIR}/libtiff_d.lib" optimized "${LIBTIFF_LIBDIR}/libtiff_o.lib") - MESSAGE(STATUS "Info: DCMTK TIFF support will be enabled") - SET(WITH_LIBTIFF 1) - ELSE(WITH_LIBTIFFINC) # turn off library if library path not set - MESSAGE(STATUS "Warning: TIFF support will be disabled because libtiff directory was not specified. Correct path and re-enable DCMTK_WITH_TIFF.") - SET(DCMTK_WITH_TIFF OFF CACHE BOOL "" FORCE) - SET(WITH_LIBTIFF "") - ENDIF(WITH_LIBTIFFINC) - ENDIF(DCMTK_WITH_TIFF) + if(DCMTK_WITH_TIFF) + if(WITH_LIBTIFFINC) + set(LIBTIFF_INCDIR "${WITH_LIBTIFFINC}/include") + set(LIBTIFF_LIBDIR "${WITH_LIBTIFFINC}/lib") + set(LIBTIFF_LIBS debug "${LIBTIFF_LIBDIR}/libtiff_d.lib" optimized "${LIBTIFF_LIBDIR}/libtiff_o.lib") + message(STATUS "Info: DCMTK TIFF support will be enabled") + set(WITH_LIBTIFF 1) + else() # turn off library if library path not set + message(STATUS "Warning: TIFF support will be disabled because libtiff directory was not specified. Correct path and re-enable DCMTK_WITH_TIFF.") + set(DCMTK_WITH_TIFF OFF CACHE BOOL "" FORCE) + set(WITH_LIBTIFF "") + endif() + endif() # OpenSSL support: configure compiler - IF(DCMTK_WITH_OPENSSL) - IF(WITH_OPENSSLINC) - INCLUDE(CheckCXXSourceCompiles) - SET(OPENSSL_BINDIR "${WITH_OPENSSLINC}/bin") - SET(OPENSSL_INCDIR "${WITH_OPENSSLINC}/include") - SET(OPENSSL_LIBDIR "${WITH_OPENSSLINC}/lib") + if(DCMTK_WITH_OPENSSL) + if(WITH_OPENSSLINC) + include(CheckCXXSourceCompiles) + set(OPENSSL_BINDIR "${WITH_OPENSSLINC}/bin") + set(OPENSSL_INCDIR "${WITH_OPENSSLINC}/include") + set(OPENSSL_LIBDIR "${WITH_OPENSSLINC}/lib") # starting with OpenSSL 1.1.0, the Windows crypt32 library is needed for a static link of OpenSSL. - SET(OPENSSL_LIBS "crypt32" debug "${OPENSSL_LIBDIR}/dcmtkssl_d.lib" optimized "${OPENSSL_LIBDIR}/dcmtkssl_o.lib" debug "${OPENSSL_LIBDIR}/dcmtkcrypto_d.lib" optimized "${OPENSSL_LIBDIR}/dcmtkcrypto_o.lib") - SET(TEMP_INCLUDES "${CMAKE_REQUIRED_INCLUDES}") - LIST(APPEND CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCDIR}") + set(OPENSSL_LIBS "crypt32" debug "${OPENSSL_LIBDIR}/dcmtkssl_d.lib" optimized "${OPENSSL_LIBDIR}/dcmtkssl_o.lib" debug "${OPENSSL_LIBDIR}/dcmtkcrypto_d.lib" optimized "${OPENSSL_LIBDIR}/dcmtkcrypto_o.lib") + set(TEMP_INCLUDES "${CMAKE_REQUIRED_INCLUDES}") + list(APPEND CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCDIR}") CHECK_CXX_SOURCE_COMPILES("extern \"C\" {\n#include \n}\nint main(){\n#if OPENSSL_VERSION_NUMBER < 0x10001000L\n#error OpenSSL too old\n#endif\n}\n" OPENSSL_VERSION_CHECK) - SET(CMAKE_REQUIRED_INCLUDES "${TEMP_INCLUDES}") - IF(OPENSSL_VERSION_CHECK) - MESSAGE(STATUS "Info: DCMTK OPENSSL support will be enabled") - SET(WITH_OPENSSL 1) - ELSE(OPENSSL_VERSION_CHECK) - MESSAGE(STATUS "Info: DCMTK OPENSSL support will be disabled: DCMTK requires OpenSSL version 1.0.1 or newer") - SET(DCMTK_WITH_OPENSSL OFF CACHE BOOL "" FORCE) - SET(WITH_OPENSSL "") - ENDIF(OPENSSL_VERSION_CHECK) - ELSE(WITH_OPENSSLINC) # turn off library if library path not set - MESSAGE(STATUS "Warning: OPENSSL support will be disabled because openssl directory was not specified. Correct path and re-enable DCMTK_WITH_OPENSSL.") - SET(DCMTK_WITH_OPENSSL OFF CACHE BOOL "" FORCE) - SET(WITH_OPENSSL "") - ENDIF(WITH_OPENSSLINC) - ENDIF(DCMTK_WITH_OPENSSL) + set(CMAKE_REQUIRED_INCLUDES "${TEMP_INCLUDES}") + if(OPENSSL_VERSION_CHECK) + message(STATUS "Info: DCMTK OPENSSL support will be enabled") + set(WITH_OPENSSL 1) + else() + message(STATUS "Info: DCMTK OPENSSL support will be disabled: DCMTK requires OpenSSL version 1.0.1 or newer") + set(DCMTK_WITH_OPENSSL OFF CACHE BOOL "" FORCE) + set(WITH_OPENSSL "") + endif() + else() # turn off library if library path not set + message(STATUS "Warning: OPENSSL support will be disabled because openssl directory was not specified. Correct path and re-enable DCMTK_WITH_OPENSSL.") + set(DCMTK_WITH_OPENSSL OFF CACHE BOOL "" FORCE) + set(WITH_OPENSSL "") + endif() + endif() # zlib support: configure compiler - IF(DCMTK_WITH_ZLIB) - IF(WITH_ZLIBINC) - SET(ZLIB_INCDIR "${WITH_ZLIBINC}/include") - SET(ZLIB_LIBDIR "${WITH_ZLIBINC}/lib") - SET(ZLIB_LIBS debug "${ZLIB_LIBDIR}/zlib_d.lib" optimized "${ZLIB_LIBDIR}/zlib_o.lib") - MESSAGE(STATUS "Info: DCMTK ZLIB support will be enabled") - SET(WITH_ZLIB 1) - ELSE(WITH_ZLIBINC) # turn off library if library path not set - MESSAGE(STATUS "Warning: ZLIB support will be disabled because zlib directory was not specified. Correct path and re-enable DCMTK_WITH_ZLIB.") - SET(DCMTK_WITH_ZLIB OFF CACHE BOOL "" FORCE) - SET(WITH_ZLIB "") - ENDIF(WITH_ZLIBINC) - ENDIF(DCMTK_WITH_ZLIB) + if(DCMTK_WITH_ZLIB) + if(WITH_ZLIBINC) + set(ZLIB_INCDIR "${WITH_ZLIBINC}/include") + set(ZLIB_LIBDIR "${WITH_ZLIBINC}/lib") + set(ZLIB_LIBS debug "${ZLIB_LIBDIR}/zlib_d.lib" optimized "${ZLIB_LIBDIR}/zlib_o.lib") + message(STATUS "Info: DCMTK ZLIB support will be enabled") + set(WITH_ZLIB 1) + else() # turn off library if library path not set + message(STATUS "Warning: ZLIB support will be disabled because zlib directory was not specified. Correct path and re-enable DCMTK_WITH_ZLIB.") + set(DCMTK_WITH_ZLIB OFF CACHE BOOL "" FORCE) + set(WITH_ZLIB "") + endif() + endif() # sndfile support: configure compiler - IF(DCMTK_WITH_SNDFILE) - IF(WITH_SNDFILEINC) - SET(SNDFILE_INCDIR "${WITH_SNDFILEINC}/include") - SET(SNDFILE_LIBDIR "${WITH_SNDFILEINC}/lib") - SET(SNDFILE_LIBS debug "${SNDFILE_LIBDIR}/libsndfile_d.lib" optimized "${SNDFILE_LIBDIR}/libsndfile_o.lib") - MESSAGE(STATUS "Info: DCMTK SNDFILE support will be enabled") - SET(WITH_SNDFILE 1) - ELSE(WITH_SNDFILEINC) # turn off library if library path not set - MESSAGE(STATUS "Warning: SNDFILE support will be disabled because libsndfile directory was not specified. Correct path and re-enable DCMTK_WITH_SNDFILE.") - SET(DCMTK_WITH_SNDFILE OFF CACHE BOOL "" FORCE) - SET(WITH_SNDFILE "") - ENDIF(WITH_SNDFILEINC) - ENDIF(DCMTK_WITH_SNDFILE) + if(DCMTK_WITH_SNDFILE) + if(WITH_SNDFILEINC) + set(SNDFILE_INCDIR "${WITH_SNDFILEINC}/include") + set(SNDFILE_LIBDIR "${WITH_SNDFILEINC}/lib") + set(SNDFILE_LIBS debug "${SNDFILE_LIBDIR}/libsndfile_d.lib" optimized "${SNDFILE_LIBDIR}/libsndfile_o.lib") + message(STATUS "Info: DCMTK SNDFILE support will be enabled") + set(WITH_SNDFILE 1) + else() # turn off library if library path not set + message(STATUS "Warning: SNDFILE support will be disabled because libsndfile directory was not specified. Correct path and re-enable DCMTK_WITH_SNDFILE.") + set(DCMTK_WITH_SNDFILE OFF CACHE BOOL "" FORCE) + set(WITH_SNDFILE "") + endif() + endif() # libiconv support: configure compiler - IF(DCMTK_WITH_ICONV) - IF(WITH_LIBICONVINC) - SET(LIBICONV_INCDIR "${WITH_LIBICONVINC}/include") - SET(LIBICONV_LIBDIR "${WITH_LIBICONVINC}/lib") - SET(LIBICONV_LIBS debug "${LIBICONV_LIBDIR}/libiconv_d.lib" optimized "${LIBICONV_LIBDIR}/libiconv_o.lib") - MESSAGE(STATUS "Info: DCMTK ICONV support will be enabled") - SET(WITH_LIBICONV 1) - ELSE(WITH_LIBICONVINC) # turn off library if library path not set - MESSAGE(STATUS "Warning: ICONV support will be disabled because libiconv directory was not specified. Correct path and re-enable DCMTK_WITH_ICONV.") - SET(DCMTK_WITH_ICONV OFF CACHE BOOL "" FORCE) - SET(WITH_LIBICONV "") - ENDIF(WITH_LIBICONVINC) - ENDIF(DCMTK_WITH_ICONV) + if(DCMTK_WITH_ICONV) + if(WITH_LIBICONVINC) + set(LIBICONV_INCDIR "${WITH_LIBICONVINC}/include") + set(LIBICONV_LIBDIR "${WITH_LIBICONVINC}/lib") + set(LIBICONV_LIBS debug "${LIBICONV_LIBDIR}/libiconv_d.lib" optimized "${LIBICONV_LIBDIR}/libiconv_o.lib") + message(STATUS "Info: DCMTK ICONV support will be enabled") + set(WITH_LIBICONV 1) + else() # turn off library if library path not set + message(STATUS "Warning: ICONV support will be disabled because libiconv directory was not specified. Correct path and re-enable DCMTK_WITH_ICONV.") + set(DCMTK_WITH_ICONV OFF CACHE BOOL "" FORCE) + set(WITH_LIBICONV "") + endif() + endif() -ELSE(WIN32 AND NOT MINGW) +else() # Find TIFF - IF(DCMTK_WITH_TIFF) - FIND_PACKAGE(TIFF QUIET) + if(DCMTK_WITH_TIFF) + find_package(TIFF QUIET) # turn off library if it could not be found - IF(NOT TIFF_FOUND) - MESSAGE(STATUS "Warning: TIFF support will be disabled because libtiff was not found.") - SET(DCMTK_WITH_TIFF OFF CACHE BOOL "" FORCE) - SET(WITH_LIBTIFF "") - ELSE(NOT TIFF_FOUND) - MESSAGE(STATUS "Info: DCMTK TIFF support will be enabled") - SET(WITH_LIBTIFF 1) + if(NOT TIFF_FOUND) + message(STATUS "Warning: TIFF support will be disabled because libtiff was not found.") + set(DCMTK_WITH_TIFF OFF CACHE BOOL "" FORCE) + set(WITH_LIBTIFF "") + else() + message(STATUS "Info: DCMTK TIFF support will be enabled") + set(WITH_LIBTIFF 1) # libtiff can be compiled with libjpeg support; if available, add libjpeg to library and include path - FIND_PACKAGE(JPEG QUIET) - INCLUDE_DIRECTORIES(${TIFF_INCLUDE_DIR} ${JPEG_INCLUDE_DIR}) - SET(LIBTIFF_LIBS ${TIFF_LIBRARY} ${JPEG_LIBRARY}) - ENDIF(NOT TIFF_FOUND) - ENDIF(DCMTK_WITH_TIFF) + find_package(JPEG QUIET) + include_directories(${TIFF_INCLUDE_DIR} ${JPEG_INCLUDE_DIR}) + set(LIBTIFF_LIBS ${TIFF_LIBRARY} ${JPEG_LIBRARY}) + endif() + endif() # Find PNG - IF(DCMTK_WITH_PNG) - FIND_PACKAGE(PNG QUIET) - IF(NOT PNG_FOUND) - SET(DCMTK_WITH_PNG OFF CACHE BOOL "" FORCE) - MESSAGE(STATUS "Warning: PNG support will be disabled because libpng was not found.") - SET(WITH_LIBPNG "") - ELSE(NOT PNG_FOUND) - MESSAGE(STATUS "Info: DCMTK PNG support will be enabled") - SET(WITH_LIBPNG 1) - INCLUDE_DIRECTORIES(${PNG_INCLUDE_DIR}) - SET(LIBPNG_LIBS ${PNG_LIBRARY}) - ENDIF(NOT PNG_FOUND) - ENDIF(DCMTK_WITH_PNG) + if(DCMTK_WITH_PNG) + find_package(PNG QUIET) + if(NOT PNG_FOUND) + set(DCMTK_WITH_PNG OFF CACHE BOOL "" FORCE) + message(STATUS "Warning: PNG support will be disabled because libpng was not found.") + set(WITH_LIBPNG "") + else() + message(STATUS "Info: DCMTK PNG support will be enabled") + set(WITH_LIBPNG 1) + include_directories(${PNG_INCLUDE_DIR}) + set(LIBPNG_LIBS ${PNG_LIBRARY}) + endif() + endif() # Find OpenSSL - IF(DCMTK_WITH_OPENSSL) - FIND_PACKAGE(OpenSSL QUIET) - IF(NOT OPENSSL_FOUND) - MESSAGE(STATUS "Warning: OPENSSL support will be disabled because openssl was not found.") - SET(WITH_OPENSSL "") - SET(DCMTK_WITH_OPENSSL OFF CACHE BOOL "" FORCE) - ELSE(NOT OPENSSL_FOUND) - INCLUDE(CheckLibraryExists) - INCLUDE(CheckCXXSourceCompiles) + if(DCMTK_WITH_OPENSSL) + find_package(OpenSSL QUIET) + if(NOT OPENSSL_FOUND) + message(STATUS "Warning: OPENSSL support will be disabled because openssl was not found.") + set(WITH_OPENSSL "") + set(DCMTK_WITH_OPENSSL OFF CACHE BOOL "" FORCE) + else() + include(CheckLibraryExists) + include(CheckCXXSourceCompiles) CHECK_CXX_SOURCE_COMPILES("extern \"C\" {\n#include \n}\nint main(){\n#if OPENSSL_VERSION_NUMBER < 0x10001000L\n#error OpenSSL too old\n#endif\n}\n" OPENSSL_VERSION_CHECK) - IF(OPENSSL_VERSION_CHECK) - MESSAGE(STATUS "Info: DCMTK OPENSSL support will be enabled") - SET(WITH_OPENSSL 1) - INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR}) - SET(OPENSSL_LIBS ${OPENSSL_LIBRARIES}) + if(OPENSSL_VERSION_CHECK) + message(STATUS "Info: DCMTK OPENSSL support will be enabled") + set(WITH_OPENSSL 1) + include_directories(${OPENSSL_INCLUDE_DIR}) + set(OPENSSL_LIBS ${OPENSSL_LIBRARIES}) CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_LIBDL) - IF(HAVE_LIBDL) - SET(OPENSSL_LIBS ${OPENSSL_LIBS} dl) - ENDIF(HAVE_LIBDL) - ELSE(OPENSSL_VERSION_CHECK) - MESSAGE(STATUS "Info: DCMTK OPENSSL support will be disabled: DCMTK requires OpenSSL version 1.0.1 or newer") - SET(DCMTK_WITH_OPENSSL OFF CACHE BOOL "" FORCE) - SET(WITH_OPENSSL "") - ENDIF(OPENSSL_VERSION_CHECK) - ENDIF(NOT OPENSSL_FOUND) - ENDIF(DCMTK_WITH_OPENSSL) + if(HAVE_LIBDL) + set(OPENSSL_LIBS ${OPENSSL_LIBS} dl) + endif() + else() + message(STATUS "Info: DCMTK OPENSSL support will be disabled: DCMTK requires OpenSSL version 1.0.1 or newer") + set(DCMTK_WITH_OPENSSL OFF CACHE BOOL "" FORCE) + set(WITH_OPENSSL "") + endif() + endif() + endif() # Find libXML2 - IF(DCMTK_WITH_XML) - FIND_PACKAGE(LibXml2 QUIET) - IF(NOT LIBXML2_FOUND) - MESSAGE(STATUS "Warning: XML support will be disabled because libxml2 was not found.") - SET(WITH_LIBXML "") - SET(DCMTK_WITH_XML OFF CACHE BOOL "" FORCE) - ELSE(NOT LIBXML2_FOUND) - MESSAGE(STATUS "Info: DCMTK XML support will be enabled") - SET(WITH_LIBXML 1) - INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) - SET(LIBXML_LIBS ${LIBXML2_LIBRARIES}) - ENDIF(NOT LIBXML2_FOUND) - ENDIF(DCMTK_WITH_XML) + if(DCMTK_WITH_XML) + find_package(LibXml2 QUIET) + if(NOT LIBXML2_FOUND) + message(STATUS "Warning: XML support will be disabled because libxml2 was not found.") + set(WITH_LIBXML "") + set(DCMTK_WITH_XML OFF CACHE BOOL "" FORCE) + else() + message(STATUS "Info: DCMTK XML support will be enabled") + set(WITH_LIBXML 1) + include_directories(${LIBXML2_INCLUDE_DIR}) + set(LIBXML_LIBS ${LIBXML2_LIBRARIES}) + endif() + endif() # Find zlib - IF(DCMTK_WITH_ZLIB) - FIND_PACKAGE(ZLIB QUIET) - IF(NOT ZLIB_FOUND) - MESSAGE(STATUS "Warning: ZLIB support will be disabled because zlib was not found.") - SET(WITH_ZLIB "") - SET(DCMTK_WITH_ZLIB OFF CACHE BOOL "" FORCE) - ELSE(NOT ZLIB_FOUND) - MESSAGE(STATUS "Info: DCMTK ZLIB support will be enabled") - SET(WITH_ZLIB 1) - INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS}) - SET(ZLIB_LIBS ${ZLIB_LIBRARIES}) - ENDIF(NOT ZLIB_FOUND) - ENDIF(DCMTK_WITH_ZLIB) + if(DCMTK_WITH_ZLIB) + find_package(ZLIB QUIET) + if(NOT ZLIB_FOUND) + message(STATUS "Warning: ZLIB support will be disabled because zlib was not found.") + set(WITH_ZLIB "") + set(DCMTK_WITH_ZLIB OFF CACHE BOOL "" FORCE) + else() + message(STATUS "Info: DCMTK ZLIB support will be enabled") + set(WITH_ZLIB 1) + include_directories(${ZLIB_INCLUDE_DIRS}) + set(ZLIB_LIBS ${ZLIB_LIBRARIES}) + endif() + endif() # Find libsndfile - IF(DCMTK_WITH_SNDFILE) - FIND_PACKAGE(Sndfile QUIET) - IF(NOT SNDFILE_LIBS) - MESSAGE(STATUS "Warning: SNDFILE support will be disabled because libsndfile was not found.") - SET(WITH_SNDFILE "") - SET(DCMTK_WITH_SNDFILE OFF CACHE BOOL "" FORCE) - ELSE(NOT SNDFILE_LIBS) - MESSAGE(STATUS "Info: DCMTK SNDFILE support will be enabled") - SET(WITH_SNDFILE 1) - INCLUDE_DIRECTORIES(${SNDFILE_INCLUDE_DIRS}) - SET(SNDFILE_LIBS ${SNDFILE_LIBRARIES}) - ENDIF(NOT SNDFILE_LIBS) - ENDIF(DCMTK_WITH_SNDFILE) + if(DCMTK_WITH_SNDFILE) + find_package(Sndfile QUIET) + if(NOT SNDFILE_LIBS) + message(STATUS "Warning: SNDFILE support will be disabled because libsndfile was not found.") + set(WITH_SNDFILE "") + set(DCMTK_WITH_SNDFILE OFF CACHE BOOL "" FORCE) + else() + message(STATUS "Info: DCMTK SNDFILE support will be enabled") + set(WITH_SNDFILE 1) + include_directories(${SNDFILE_INCLUDE_DIRS}) + set(SNDFILE_LIBS ${SNDFILE_LIBRARIES}) + endif() + endif() # Find libiconv - IF(DCMTK_WITH_ICONV) - FIND_PACKAGE(ICONV QUIET) - FIND_PACKAGE(Charset QUIET) - IF(NOT LIBICONV_FOUND OR NOT LIBCHARSET_FOUND) - MESSAGE(STATUS "Warning: ICONV support will be disabled because libiconv was not found. Correct LIBICONV_LIBDIR and LIBICONV_INCLUDE_DIR and re-enable DCMTK_WITH_ICONV.") - SET(DCMTK_WITH_ICONV OFF CACHE BOOL "" FORCE) - SET(WITH_LIBICONV "") - ELSE(NOT LIBICONV_FOUND OR NOT LIBCHARSET_FOUND) - MESSAGE(STATUS "Info: DCMTK ICONV support will be enabled") - SET(WITH_LIBICONV 1) - SET(LIBICONV_INCDIR ${LIBICONV_INCLUDE_DIRS} ${LIBCHARSET_INCLUDE_DIRS}) - SET(LIBICONV_LIBDIR ${LIBICONV_LIBDIR}) - SET(LIBICONV_LIBS ${LIBICONV_LIBRARIES} ${LIBCHARSET_LIBRARY}) - INCLUDE_DIRECTORIES(${LIBICONV_INCDIR}) - ENDIF(NOT LIBICONV_FOUND OR NOT LIBCHARSET_FOUND) - ENDIF(DCMTK_WITH_ICONV) + if(DCMTK_WITH_ICONV) + find_package(ICONV QUIET) + find_package(Charset QUIET) + if(NOT LIBICONV_FOUND OR NOT LIBCHARSET_FOUND) + message(STATUS "Warning: ICONV support will be disabled because libiconv was not found. Correct LIBICONV_LIBDIR and LIBICONV_INCLUDE_DIR and re-enable DCMTK_WITH_ICONV.") + set(DCMTK_WITH_ICONV OFF CACHE BOOL "" FORCE) + set(WITH_LIBICONV "") + else() + message(STATUS "Info: DCMTK ICONV support will be enabled") + set(WITH_LIBICONV 1) + set(LIBICONV_INCDIR ${LIBICONV_INCLUDE_DIRS} ${LIBCHARSET_INCLUDE_DIRS}) + set(LIBICONV_LIBDIR ${LIBICONV_LIBDIR}) + set(LIBICONV_LIBS ${LIBICONV_LIBRARIES} ${LIBCHARSET_LIBRARY}) + include_directories(${LIBICONV_INCDIR}) + endif() + endif() # Find libwrap - IF(DCMTK_WITH_WRAP) - FIND_PACKAGE(Wrap QUIET) - IF(NOT WRAP_FOUND) - MESSAGE(STATUS "Warning: WRAP support will be disabled because libwrap was not found.") - SET(WITH_TCPWRAPPER "") - SET(DCMTK_WITH_WRAP OFF CACHE BOOL "" FORCE) - ELSE(NOT WRAP_FOUND) - MESSAGE(STATUS "Info: DCMTK WRAP support will be enabled") - SET(WITH_TCPWRAPPER 1) - INCLUDE_DIRECTORIES(${WRAP_INCLUDE_DIRS}) - SET(WRAP_LIBS ${WRAP_LIBRARIES}) - ENDIF(NOT WRAP_FOUND) - ENDIF(DCMTK_WITH_WRAP) + if(DCMTK_WITH_WRAP) + find_package(Wrap QUIET) + if(NOT WRAP_FOUND) + message(STATUS "Warning: WRAP support will be disabled because libwrap was not found.") + set(WITH_TCPWRAPPER "") + set(DCMTK_WITH_WRAP OFF CACHE BOOL "" FORCE) + else() + message(STATUS "Info: DCMTK WRAP support will be enabled") + set(WITH_TCPWRAPPER 1) + include_directories(${WRAP_INCLUDE_DIRS}) + set(WRAP_LIBS ${WRAP_LIBRARIES}) + endif() + endif() -ENDIF() +endif() -IF(NOT DEFINED DCMTK_WITH_STDLIBC_ICONV) - INCLUDE(CheckCXXSourceCompiles) +if(NOT DEFINED DCMTK_WITH_STDLIBC_ICONV) + include(CheckCXXSourceCompiles) CHECK_CXX_SOURCE_COMPILES("#include \nint main(){iconv_t cd = iconv_open(\"\",\"\");iconv(cd,0,0,0,0);iconv_close(cd);return 0;}" WITH_STDLIBC_ICONV) - IF(WITH_STDLIBC_ICONV) - MESSAGE(STATUS "Info: found builtin ICONV support inside the C standard library.") - SET(DCMTK_WITH_STDLIBC_ICONV ON CACHE BOOL "" FORCE) - ELSE(WITH_STDLIBC_ICONV) - SET(DCMTK_WITH_STDLIBC_ICONV OFF CACHE BOOL "" FORCE) - ENDIF(WITH_STDLIBC_ICONV) -ENDIF(NOT DEFINED DCMTK_WITH_STDLIBC_ICONV) + if(WITH_STDLIBC_ICONV) + message(STATUS "Info: found builtin ICONV support inside the C standard library.") + set(DCMTK_WITH_STDLIBC_ICONV ON CACHE BOOL "" FORCE) + else() + set(DCMTK_WITH_STDLIBC_ICONV OFF CACHE BOOL "" FORCE) + endif() +endif() -IF(DCMTK_WITH_ICU) - FIND_PACKAGE(ICU COMPONENTS uc data QUIET) - IF(NOT ICU_FOUND) - MESSAGE(STATUS "Warning: ICU support will be disabled because the ICU were not found.") - SET(DCMTK_WITH_ICU OFF CACHE BOOL "" FORCE) - SET(WITH_ICU "") - ELSE(NOT ICU_FOUND) - MESSAGE(STATUS "Info: DCMTK ICU support will be enabled") - SET(WITH_ICU 1) - SET(ICU_INCDIR ${ICU_INCLUDE_DIR}) - SET(ICU_LIBS ${ICU_LIBRARIES}) - INCLUDE_DIRECTORIES(${ICU_INCLUDE_DIR}) - ENDIF(NOT ICU_FOUND) -ENDIF(DCMTK_WITH_ICU) +if(DCMTK_WITH_ICU) + find_package(ICU COMPONENTS uc data QUIET) + if(NOT ICU_FOUND) + message(STATUS "Warning: ICU support will be disabled because the ICU were not found.") + set(DCMTK_WITH_ICU OFF CACHE BOOL "" FORCE) + set(WITH_ICU "") + else() + message(STATUS "Info: DCMTK ICU support will be enabled") + set(WITH_ICU 1) + set(ICU_INCDIR ${ICU_INCLUDE_DIR}) + set(ICU_LIBS ${ICU_LIBRARIES}) + include_directories(${ICU_INCLUDE_DIR}) + endif() +endif() # Find doxygen -IF(DCMTK_WITH_DOXYGEN) - FIND_PACKAGE(Doxygen QUIET) # will set variable DOXYGEN_EXECUTABLE - IF(NOT DOXYGEN_FOUND) - MESSAGE(STATUS "Warning: DOXYGEN support will be disabled because doxygen was not found.") - SET(DCMTK_WITH_DOXYGEN OFF CACHE BOOL "" FORCE) - ENDIF(NOT DOXYGEN_FOUND) -ENDIF(DCMTK_WITH_DOXYGEN) +if(DCMTK_WITH_DOXYGEN) + find_package(Doxygen QUIET) # will set variable DOXYGEN_EXECUTABLE + if(NOT DOXYGEN_FOUND) + message(STATUS "Warning: DOXYGEN support will be disabled because doxygen was not found.") + set(DCMTK_WITH_DOXYGEN OFF CACHE BOOL "" FORCE) + endif() +endif() -IF(DCMTK_WITH_ICONV OR DCMTK_WITH_STDLIBC_ICONV) - INCLUDE(CheckCXXSourceCompiles) - SET(CMAKE_REQUIRED_INCLUDES ${LIBICONV_INCDIR}) - SET(CMAKE_REQUIRED_LIBRARIES ${LIBICONV_LIBS}) +if(DCMTK_WITH_ICONV OR DCMTK_WITH_STDLIBC_ICONV) + include(CheckCXXSourceCompiles) + set(CMAKE_REQUIRED_INCLUDES ${LIBICONV_INCDIR}) + set(CMAKE_REQUIRED_LIBRARIES ${LIBICONV_LIBS}) CHECK_CXX_SOURCE_COMPILES(" #include int main() { @@ -343,6 +343,6 @@ IF(DCMTK_WITH_ICONV OR DCMTK_WITH_STDLIBC_ICONV) iconv(cd, &in, 0, 0, 0); return 0; }" LIBICONV_SECOND_ARGUMENT_CONST) - SET(CMAKE_REQUIRED_INCLUDES) - SET(CMAKE_REQUIRED_LIBRARIES) -ENDIF(DCMTK_WITH_ICONV OR DCMTK_WITH_STDLIBC_ICONV) + set(CMAKE_REQUIRED_INCLUDES) + set(CMAKE_REQUIRED_LIBRARIES) +endif() diff --git a/CMake/CTest/CTestCustomAndroid.cmake.in b/CMake/CTest/CTestCustomAndroid.cmake.in index 2b93e0b28b..4e738fd729 100644 --- a/CMake/CTest/CTestCustomAndroid.cmake.in +++ b/CMake/CTest/CTestCustomAndroid.cmake.in @@ -5,36 +5,36 @@ # # Restore the required settings of the CMake configuration step -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -SET(CMAKE_COMMAND "@CMAKE_COMMAND@") -SET(CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@") -SET(CMAKE_CURRENT_BINARY_DIR "@CMAKE_BINARY_DIR@") -SET(CMAKE_FILES_DIRECTORY "@CMAKE_FILES_DIRECTORY@") -SET(CMAKE_MODULE_PATH "@CMAKE_ROOT@/Modules") -SET(CMAKE_SHARED_LIBRARY_PREFIX "@CMAKE_SHARED_LIBRARY_PREFIX@") -SET(CMAKE_SHARED_LIBRARY_SUFFIX "@CMAKE_SHARED_LIBRARY_SUFFIX@") -SET(CMAKE_HOST_SYSTEM "@CMAKE_HOST_SYSTEM@") -SET(DCMTK_CMAKE_INCLUDE "@CMAKE_SOURCE_DIR@/@DCMTK_CMAKE_INCLUDE@") -SET(DCMTK_TEST_EXECUTABLES "@DCMTK_TEST_EXECUTABLES@") -SET(DCMTK_ALL_LIBRARIES "@DCMTK_ALL_LIBRARIES@") -SET(DCMTK_LIBRARY_DEPENDENCIES "@DCMTK_LIBRARY_DEPENDENCIES@") -SET(DCMTK_PACKAGE_VERSION "@DCMTK_PACKAGE_VERSION@") -SET(DCMTK_ABI_VERSION "@DCMTK_ABI_VERSION@") -SET(BUILD_SHARED_LIBS "@BUILD_SHARED_LIBS@") -SET(DCMTK_DICOM_DICTIONARIES "@DCMTK_DICOM_DICTIONARIES@") -SET(ANDROID "@ANDROID@") -SET(ANDROID_ADB_PROGRAM "@ANDROID_ADB_PROGRAM@") -SET(ANDROID_ANDROID_PROGRAM "@ANDROID_ANDROID_PROGRAM@") -SET(ANDROID_EMULATOR_PROGRAM "@ANDROID_EMULATOR_PROGRAM@") -SET(ANDROID_EMULATOR_AVD "@ANDROID_EMULATOR_AVD@") -SET(ANDROID_RUNTIME_LIBRARIES "@ANDROID_RUNTIME_LIBRARIES@") -SET(ANDROID_TEMPORARY_FILES_LOCATION "@ANDROID_TEMPORARY_FILES_LOCATION@") +cmake_minimum_required(VERSION 2.6) +set(CMAKE_COMMAND "@CMAKE_COMMAND@") +set(CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@") +set(CMAKE_CURRENT_BINARY_DIR "@CMAKE_BINARY_DIR@") +set(CMAKE_FILES_DIRECTORY "@CMAKE_FILES_DIRECTORY@") +set(CMAKE_MODULE_PATH "@CMAKE_ROOT@/Modules") +set(CMAKE_SHARED_LIBRARY_PREFIX "@CMAKE_SHARED_LIBRARY_PREFIX@") +set(CMAKE_SHARED_LIBRARY_SUFFIX "@CMAKE_SHARED_LIBRARY_SUFFIX@") +set(CMAKE_HOST_SYSTEM "@CMAKE_HOST_SYSTEM@") +set(DCMTK_CMAKE_INCLUDE "@CMAKE_SOURCE_DIR@/@DCMTK_CMAKE_INCLUDE@") +set(DCMTK_TEST_EXECUTABLES "@DCMTK_TEST_EXECUTABLES@") +set(DCMTK_ALL_LIBRARIES "@DCMTK_ALL_LIBRARIES@") +set(DCMTK_LIBRARY_DEPENDENCIES "@DCMTK_LIBRARY_DEPENDENCIES@") +set(DCMTK_PACKAGE_VERSION "@DCMTK_PACKAGE_VERSION@") +set(DCMTK_ABI_VERSION "@DCMTK_ABI_VERSION@") +set(BUILD_SHARED_LIBS "@BUILD_SHARED_LIBS@") +set(DCMTK_DICOM_DICTIONARIES "@DCMTK_DICOM_DICTIONARIES@") +set(ANDROID "@ANDROID@") +set(ANDROID_ADB_PROGRAM "@ANDROID_ADB_PROGRAM@") +set(ANDROID_ANDROID_PROGRAM "@ANDROID_ANDROID_PROGRAM@") +set(ANDROID_EMULATOR_PROGRAM "@ANDROID_EMULATOR_PROGRAM@") +set(ANDROID_EMULATOR_AVD "@ANDROID_EMULATOR_AVD@") +set(ANDROID_RUNTIME_LIBRARIES "@ANDROID_RUNTIME_LIBRARIES@") +set(ANDROID_TEMPORARY_FILES_LOCATION "@ANDROID_TEMPORARY_FILES_LOCATION@") # Emulate some required CMake commands while running inside CTest -INCLUDE(${DCMTK_CMAKE_INCLUDE}CMake/CTest/dcmtkCTestMacros.cmake) +include(${DCMTK_CMAKE_INCLUDE}CMake/CTest/dcmtkCTestMacros.cmake) # For DCMTK_UNSET_XXX -INCLUDE(${DCMTK_CMAKE_INCLUDE}CMake/dcmtkMacros.cmake) +include(${DCMTK_CMAKE_INCLUDE}CMake/dcmtkMacros.cmake) # Load required functions for controlling the Android device emulator -INCLUDE(${DCMTK_CMAKE_INCLUDE}CMake/dcmtkUseAndroidSDK.cmake) +include(${DCMTK_CMAKE_INCLUDE}CMake/dcmtkUseAndroidSDK.cmake) # Prepare the Android testing environment # Prepare the emulator @@ -51,20 +51,20 @@ MESSAGE_COMMAND(STOP_MESSAGE ${STOP_MESSAGE}) # CTEST_CUSTOM_POST_TESTS executes a sequence of 'non CMake' commands separated # by ';' characters. Therefore the sequence a single command consists of must # be translated appropriately first -STRING(REPLACE ";" " " STOP_EMULATOR "${STOP_EMULATOR}") -STRING(REPLACE ";" " " STOP_MESSAGE "${STOP_MESSAGE}") +string(REPLACE ";" " " STOP_EMULATOR "${STOP_EMULATOR}") +string(REPLACE ";" " " STOP_MESSAGE "${STOP_MESSAGE}") # Register the cleanup hooks -SET(CTEST_CUSTOM_POST_TEST "${STOP_MESSAGE}" "${STOP_EMULATOR}") +set(CTEST_CUSTOM_POST_TEST "${STOP_MESSAGE}" "${STOP_EMULATOR}") # Set the current emulator instance handle via an environment variable -SET(ENV{DCMTK_ANDROID_EMULATOR_INSTANCE} "${DCMTK_ANDROID_EMULATOR_INSTANCE}") +set(ENV{DCMTK_ANDROID_EMULATOR_INSTANCE} "${DCMTK_ANDROID_EMULATOR_INSTANCE}") # Collect the list of required libraries -IF(BUILD_SHARED_LIBS) - FOREACH(LIBRARY ${DCMTK_ALL_LIBRARIES}) - LIST(APPEND DCMTK_CREATED_SHARED_LIBRARIES "${CMAKE_BINARY_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${LIBRARY}${CMAKE_SHARED_LIBRARY_SUFFIX}.${DCMTK_PACKAGE_VERSION}") - ENDFOREACH() -ENDIF(BUILD_SHARED_LIBS) +if(BUILD_SHARED_LIBS) + foreach(LIBRARY ${DCMTK_ALL_LIBRARIES}) + list(APPEND DCMTK_CREATED_SHARED_LIBRARIES "${CMAKE_BINARY_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${LIBRARY}${CMAKE_SHARED_LIBRARY_SUFFIX}.${DCMTK_PACKAGE_VERSION}") + endforeach() +endif() # Transmit the required executables, libraries and dictionaries to the emulator DCMTK_ANDROID_PUSH(DCMTK_ANDROID_EMULATOR_INSTANCE @@ -77,22 +77,22 @@ DCMTK_ANDROID_PUSH(DCMTK_ANDROID_EMULATOR_INSTANCE ) # Set executable permissions -FOREACH(TEST_EXECUTABLE ${DCMTK_TEST_EXECUTABLES}) - GET_FILENAME_COMPONENT(NAME "${TEST_EXECUTABLE}" NAME) +foreach(TEST_EXECUTABLE ${DCMTK_TEST_EXECUTABLES}) + get_filename_component(NAME "${TEST_EXECUTABLE}" NAME) DCMTK_ANDROID_SHELL(DCMTK_ANDROID_EMULATOR_INSTANCE COMMAND chmod 755 "${ANDROID_TEMPORARY_FILES_LOCATION}/${NAME}" OUTPUT_QUIET ERROR_QUIET ) -ENDFOREACH() +endforeach() # Create necessary softlinks -IF(BUILD_SHARED_LIBS) - FOREACH(LIBRARY ${DCMTK_ALL_LIBRARIES}) +if(BUILD_SHARED_LIBS) + foreach(LIBRARY ${DCMTK_ALL_LIBRARIES}) DCMTK_ANDROID_SHELL(DCMTK_ANDROID_EMULATOR_INSTANCE COMMAND ln -s "./${CMAKE_SHARED_LIBRARY_PREFIX}${LIBRARY}${CMAKE_SHARED_LIBRARY_SUFFIX}.${DCMTK_PACKAGE_VERSION}" "${ANDROID_TEMPORARY_FILES_LOCATION}/${CMAKE_SHARED_LIBRARY_PREFIX}${LIBRARY}${CMAKE_SHARED_LIBRARY_SUFFIX}.${DCMTK_ABI_VERSION}" OUTPUT_QUIET ERROR_QUIET ) - ENDFOREACH() -ENDIF(BUILD_SHARED_LIBS) + endforeach() +endif() diff --git a/CMake/CTest/CTestCustomWine.cmake.in b/CMake/CTest/CTestCustomWine.cmake.in index 4ec2eb3947..12b40a364d 100644 --- a/CMake/CTest/CTestCustomWine.cmake.in +++ b/CMake/CTest/CTestCustomWine.cmake.in @@ -4,13 +4,13 @@ # workaround, but what can you do? # -SET(ENV{WINEPREFIX} "@DCMTK_WINEPREFIX@") -SET(ENV{DCMDICTPATH} "@DCMDICTPATH@") -SET(WINE_WINE_PROGRAM "@WINE_WINE_PROGRAM@") +set(ENV{WINEPREFIX} "@DCMTK_WINEPREFIX@") +set(ENV{DCMDICTPATH} "@DCMDICTPATH@") +set(WINE_WINE_PROGRAM "@WINE_WINE_PROGRAM@") # spawn the winserver using 'cmd /C call' -> effectively NOP # spawn it using 'sh', such that this script does not attach itself to it. -EXECUTE_PROCESS(COMMAND +execute_process(COMMAND sh -c "\"${WINE_WINE_PROGRAM}\" cmd /C call" OUTPUT_FILE "/dev/null" ERROR_FILE "/dev/null" diff --git a/CMake/CTest/dcmtkCTestMacros.cmake b/CMake/CTest/dcmtkCTestMacros.cmake index b3a7eb50e2..3a4f1bcaf2 100644 --- a/CMake/CTest/dcmtkCTestMacros.cmake +++ b/CMake/CTest/dcmtkCTestMacros.cmake @@ -3,25 +3,25 @@ # that is missing inside CTest. # -MACRO(MESSAGE_COMMAND VAR MODE) - IF(${MODE} STREQUAL "STATUS") - SET(${VAR} ${CMAKE_COMMAND} -E echo -- ${ARGN}) - ELSEIF(${MODE} STREQUAL "WARNING") - SET(${VAR} ${CMAKE_COMMAND} -E echo WARNING: ${ARGN}) - ELSEIF(${MODE} STREQUAL "AUTHOR_WARNING") - SET(${VAR} ${CMAKE_COMMAND} -E echo Warning: ${ARGN}) - ELSEIF(${MODE} STREQUAL "SEND_ERROR") - SET(${VAR} ${CMAKE_COMMAND} -E echo Error: ${ARGN}) - ELSEIF(${MODE} STREQUAL "FATAL_ERROR") - SET(${VAR} ${CMAKE_COMMAND} -E echo ERROR: ${ARGN}) - ELSEIF(${MODE} STREQUAL "DEPRECATION") - SET(${VAR} ${CMAKE_COMMAND} -E echo ${ARGN}) - ELSE() - SET(${VAR} ${CMAKE_COMMAND} -E echo ${MODE} ${ARGN}) - ENDIF() -ENDMACRO(MESSAGE_COMMAND) +macro(MESSAGE_COMMAND VAR MODE) + if(${MODE} STREQUAL "STATUS") + set(${VAR} ${CMAKE_COMMAND} -E echo -- ${ARGN}) + elseif(${MODE} STREQUAL "WARNING") + set(${VAR} ${CMAKE_COMMAND} -E echo WARNING: ${ARGN}) + elseif(${MODE} STREQUAL "AUTHOR_WARNING") + set(${VAR} ${CMAKE_COMMAND} -E echo Warning: ${ARGN}) + elseif(${MODE} STREQUAL "SEND_ERROR") + set(${VAR} ${CMAKE_COMMAND} -E echo Error: ${ARGN}) + elseif(${MODE} STREQUAL "FATAL_ERROR") + set(${VAR} ${CMAKE_COMMAND} -E echo ERROR: ${ARGN}) + elseif(${MODE} STREQUAL "DEPRECATION") + set(${VAR} ${CMAKE_COMMAND} -E echo ${ARGN}) + else() + set(${VAR} ${CMAKE_COMMAND} -E echo ${MODE} ${ARGN}) + endif() +endmacro() -FUNCTION(MESSAGE) +function(MESSAGE) MESSAGE_COMMAND(COMMAND ${ARGN}) - EXECUTE_PROCESS(COMMAND ${COMMAND}) -ENDFUNCTION(MESSAGE) + execute_process(COMMAND ${COMMAND}) +endfunction() diff --git a/CMake/CTest/dcmtkCTestRun.cmake.in b/CMake/CTest/dcmtkCTestRun.cmake.in index 67bd4a4443..7b1a3da482 100644 --- a/CMake/CTest/dcmtkCTestRun.cmake.in +++ b/CMake/CTest/dcmtkCTestRun.cmake.in @@ -4,15 +4,15 @@ # environment variable appropriately. # -SET(ENV{DCMDICTPATH} "@DCMDICTPATH@") +set(ENV{DCMDICTPATH} "@DCMDICTPATH@") -EXECUTE_PROCESS(COMMAND +execute_process(COMMAND "${DCMTK_CTEST_TESTCASE_COMMAND}" $ENV{DCMTK_CTEST_EXTRA_ARGUMENTS} "${DCMTK_CTEST_TEST_NAME}" RESULT_VARIABLE RESULT ) # We cannot forward the result value to CMake, so print it instead and let CMake # return with code '1' or whatever it deems appropriate to notify about an error. -IF(RESULT) - MESSAGE(FATAL_ERROR "Test command returned: ${RESULT}") -ENDIF() +if(RESULT) + message(FATAL_ERROR "Test command returned: ${RESULT}") +endif() diff --git a/CMake/CTest/dcmtkCTestRunAndroid.cmake.in b/CMake/CTest/dcmtkCTestRunAndroid.cmake.in index 9e2632d0b0..0203373948 100644 --- a/CMake/CTest/dcmtkCTestRunAndroid.cmake.in +++ b/CMake/CTest/dcmtkCTestRunAndroid.cmake.in @@ -6,18 +6,18 @@ # # Restore the required settings of the CMake configuration step -SET(CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@") -SET(CMAKE_CURRENT_BINARY_DIR "@CMAKE_BINARY_DIR@") -SET(CMAKE_FILES_DIRECTORY "@CMAKE_FILES_DIRECTORY@") -SET(DCMTK_CMAKE_INCLUDE "@CMAKE_SOURCE_DIR@/@DCMTK_CMAKE_INCLUDE@") -SET(DCMDICTPATH "@DCMDICTPATH@") -SET(ANDROID_ADB_PROGRAM "@ANDROID_ADB_PROGRAM@") -SET(ANDROID_TEMPORARY_FILES_LOCATION "@ANDROID_TEMPORARY_FILES_LOCATION@") +set(CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@") +set(CMAKE_CURRENT_BINARY_DIR "@CMAKE_BINARY_DIR@") +set(CMAKE_FILES_DIRECTORY "@CMAKE_FILES_DIRECTORY@") +set(DCMTK_CMAKE_INCLUDE "@CMAKE_SOURCE_DIR@/@DCMTK_CMAKE_INCLUDE@") +set(DCMDICTPATH "@DCMDICTPATH@") +set(ANDROID_ADB_PROGRAM "@ANDROID_ADB_PROGRAM@") +set(ANDROID_TEMPORARY_FILES_LOCATION "@ANDROID_TEMPORARY_FILES_LOCATION@") # Load required functions for controlling the Android device emulator -INCLUDE(${DCMTK_CMAKE_INCLUDE}CMake/dcmtkUseAndroidSDK.cmake) +include(${DCMTK_CMAKE_INCLUDE}CMake/dcmtkUseAndroidSDK.cmake) # Restore the Android device emulator instance handle -SET(DCMTK_ANDROID_EMULATOR_INSTANCE "$ENV{DCMTK_ANDROID_EMULATOR_INSTANCE}") +set(DCMTK_ANDROID_EMULATOR_INSTANCE "$ENV{DCMTK_ANDROID_EMULATOR_INSTANCE}") # Run the actual testcase on the remote device DCMTK_ANDROID_SHELL(DCMTK_ANDROID_EMULATOR_INSTANCE @@ -28,6 +28,6 @@ DCMTK_ANDROID_SHELL(DCMTK_ANDROID_EMULATOR_INSTANCE # We cannot forward the result value to CTest, so print it instead and let CMake # return with code '1' or whatever it deems appropriate to notify about an error. -IF(RESULT) - MESSAGE(FATAL_ERROR "Test command returned: ${RESULT}") -ENDIF() +if(RESULT) + message(FATAL_ERROR "Test command returned: ${RESULT}") +endif() diff --git a/CMake/CTest/dcmtkCTestRunExhaustive.cmake b/CMake/CTest/dcmtkCTestRunExhaustive.cmake index 06419f33b2..b33145fa16 100644 --- a/CMake/CTest/dcmtkCTestRunExhaustive.cmake +++ b/CMake/CTest/dcmtkCTestRunExhaustive.cmake @@ -2,5 +2,5 @@ # this file is used to execute the unit tests with the -x option injected # -SET(ENV{DCMTK_CTEST_EXTRA_ARGUMENTS} "-x") -EXECUTE_PROCESS(COMMAND ${CMAKE_CTEST_COMMAND} -C "${CONFIG}") +set(ENV{DCMTK_CTEST_EXTRA_ARGUMENTS} "-x") +execute_process(COMMAND ${CMAKE_CTEST_COMMAND} -C "${CONFIG}") diff --git a/CMake/CTest/dcmtkCTestRunWine.cmake.in b/CMake/CTest/dcmtkCTestRunWine.cmake.in index 4dc0d783fd..12a3489ce6 100644 --- a/CMake/CTest/dcmtkCTestRunWine.cmake.in +++ b/CMake/CTest/dcmtkCTestRunWine.cmake.in @@ -7,17 +7,17 @@ # shutdown. # -SET(ENV{WINEPREFIX} "@DCMTK_WINEPREFIX@") -SET(ENV{DCMDICTPATH} "@DCMDICTPATH@") -SET(WINE_WINE_PROGRAM "@WINE_WINE_PROGRAM@") +set(ENV{WINEPREFIX} "@DCMTK_WINEPREFIX@") +set(ENV{DCMDICTPATH} "@DCMDICTPATH@") +set(WINE_WINE_PROGRAM "@WINE_WINE_PROGRAM@") -EXECUTE_PROCESS(COMMAND +execute_process(COMMAND "${WINE_WINE_PROGRAM}" "${DCMTK_CTEST_TESTCASE_COMMAND}" $ENV{DCMTK_CTEST_EXTRA_ARGUMENTS} "${DCMTK_CTEST_TEST_NAME}" RESULT_VARIABLE RESULT ) # We cannot forward the result value to CMake, so print it instead and let CMake # return with code '1' or whatever it deems appropriate to notify about an error. -IF(RESULT) - MESSAGE(FATAL_ERROR "Test command returned: ${RESULT}") -ENDIF() +if(RESULT) + message(FATAL_ERROR "Test command returned: ${RESULT}") +endif() diff --git a/CMake/CheckCMakeCommandExists.cmake b/CMake/CheckCMakeCommandExists.cmake index c204778e14..f73125b2d1 100644 --- a/CMake/CheckCMakeCommandExists.cmake +++ b/CMake/CheckCMakeCommandExists.cmake @@ -1,12 +1,12 @@ # Helper macro that checks whether a given CMake command exists or not -MACRO(CHECK_CMAKE_COMMAND_EXISTS commandname) - MESSAGE(STATUS "Looking for CMake command ${commandname}") +macro(CHECK_CMAKE_COMMAND_EXISTS commandname) + message(STATUS "Looking for CMake command ${commandname}") string(TOUPPER ${commandname} commandname_upper) - IF(COMMAND ${commandname}) - SET(HAVE_${commandname_upper} TRUE) - MESSAGE(STATUS "Looking for CMake command ${commandname} - found") - ELSE() - SET(HAVE_${commandname_upper} FALSE) - MESSAGE(STATUS "Looking for CMake command ${commandname} - not found") - ENDIF() -ENDMACRO() + if(COMMAND ${commandname}) + set(HAVE_${commandname_upper} TRUE) + message(STATUS "Looking for CMake command ${commandname} - found") + else() + set(HAVE_${commandname_upper} FALSE) + message(STATUS "Looking for CMake command ${commandname} - not found") + endif() +endmacro() diff --git a/CMake/CheckFunctionWithHeaderExists.cmake b/CMake/CheckFunctionWithHeaderExists.cmake index 1b95ac4878..f22f56a28d 100644 --- a/CMake/CheckFunctionWithHeaderExists.cmake +++ b/CMake/CheckFunctionWithHeaderExists.cmake @@ -8,26 +8,26 @@ # ... - additional arguments will be interpreted as additional libraries to link during testing. # -MACRO(CHECK_FUNCTIONWITHHEADER_EXISTS SYMBOL FILES VARIABLE) - IF(NOT DEFINED "${VARIABLE}") - SET(CHECK_SYMBOL_EXISTS_CONTENT "/* */\n") - SET(MACRO_CHECK_SYMBOL_EXISTS_FLAGS ${CMAKE_REQUIRED_FLAGS}) - IF(CMAKE_REQUIRED_LIBRARIES) - SET(CHECK_SYMBOL_EXISTS_LIBS +macro(CHECK_FUNCTIONWITHHEADER_EXISTS SYMBOL FILES VARIABLE) + if(NOT DEFINED "${VARIABLE}") + set(CHECK_SYMBOL_EXISTS_CONTENT "/* */\n") + set(MACRO_CHECK_SYMBOL_EXISTS_FLAGS ${CMAKE_REQUIRED_FLAGS}) + if(CMAKE_REQUIRED_LIBRARIES) + set(CHECK_SYMBOL_EXISTS_LIBS "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES};${ARGN}") - ENDIF(CMAKE_REQUIRED_LIBRARIES) - FOREACH(FILE ${FILES}) - SET(CHECK_SYMBOL_EXISTS_CONTENT + endif() + foreach(FILE ${FILES}) + set(CHECK_SYMBOL_EXISTS_CONTENT "${CHECK_SYMBOL_EXISTS_CONTENT}#include <${FILE}>\n") - ENDFOREACH(FILE) - SET(CHECK_SYMBOL_EXISTS_CONTENT + endforeach() + set(CHECK_SYMBOL_EXISTS_CONTENT "${CHECK_SYMBOL_EXISTS_CONTENT}\nint main()\n{\n${SYMBOL};return 0;\n}\n") - FILE(WRITE ${CMAKE_BINARY_DIR}/CMakeTmp/CheckSymbolExists.cxx + file(WRITE ${CMAKE_BINARY_DIR}/CMakeTmp/CheckSymbolExists.cxx "${CHECK_SYMBOL_EXISTS_CONTENT}") - MESSAGE(STATUS "Looking for prototype of ${SYMBOL}") - TRY_COMPILE(${VARIABLE} + message(STATUS "Looking for prototype of ${SYMBOL}") + try_compile(${VARIABLE} "${CMAKE_BINARY_DIR}" "${CMAKE_BINARY_DIR}/CMakeTmp/CheckSymbolExists.cxx" CMAKE_FLAGS @@ -36,22 +36,22 @@ MACRO(CHECK_FUNCTIONWITHHEADER_EXISTS SYMBOL FILES VARIABLE) "${CHECK_SYMBOL_EXISTS_LIBS}" ${DCMTK_TRY_COMPILE_REQUIRED_CMAKE_FLAGS} OUTPUT_VARIABLE OUTPUT) - IF(${VARIABLE}) - MESSAGE(STATUS "Looking for prototype of ${SYMBOL} - found") - SET(${VARIABLE} 1 CACHE INTERNAL "Have symbol ${SYMBOL}") - FILE(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log" + if(${VARIABLE}) + message(STATUS "Looking for prototype of ${SYMBOL} - found") + set(${VARIABLE} 1 CACHE INTERNAL "Have symbol ${SYMBOL}") + file(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log" "Determining if the ${SYMBOL} " "exist passed with the following output:\n" "${OUTPUT}\nFile ${CMAKE_BINARY_DIR}/CMakeTmp/CheckSymbolExists.ccc:\n" "${CHECK_SYMBOL_EXISTS_CONTENT}\n") - ELSE(${VARIABLE}) - MESSAGE(STATUS "Looking for prototype of ${SYMBOL} - not found.") - SET(${VARIABLE} "" CACHE INTERNAL "Have symbol ${SYMBOL}") - FILE(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log" + else() + message(STATUS "Looking for prototype of ${SYMBOL} - not found.") + set(${VARIABLE} "" CACHE INTERNAL "Have symbol ${SYMBOL}") + file(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log" "Determining if the ${SYMBOL} " "exist failed with the following output:\n" "${OUTPUT}\nFile ${CMAKE_BINARY_DIR}/CMakeTmp/CheckSymbolExists.cxx:\n" "${CHECK_SYMBOL_EXISTS_CONTENT}\n") - ENDIF(${VARIABLE}) - ENDIF(NOT DEFINED "${VARIABLE}") -ENDMACRO(CHECK_FUNCTIONWITHHEADER_EXISTS) + endif() + endif() +endmacro() diff --git a/CMake/DCMTKConfig.cmake.in b/CMake/DCMTKConfig.cmake.in index b574626717..66507330ca 100644 --- a/CMake/DCMTKConfig.cmake.in +++ b/CMake/DCMTKConfig.cmake.in @@ -5,56 +5,56 @@ @PACKAGE_INIT@ # Basic version information -SET(DCMTK_MAJOR_VERSION @DCMTK_MAJOR_VERSION@) -SET(DCMTK_MINOR_VERSION @DCMTK_MINOR_VERSION@) -SET(DCMTK_BUILD_VERSION @DCMTK_BUILD_VERSION@) +set(DCMTK_MAJOR_VERSION @DCMTK_MAJOR_VERSION@) +set(DCMTK_MINOR_VERSION @DCMTK_MINOR_VERSION@) +set(DCMTK_BUILD_VERSION @DCMTK_BUILD_VERSION@) # DCMTK libraries and modules -SET(DCMTK_MODULES "@DCMTK_MODULES@") -SET(DCMTK_LIBRARIES "@DCMTK_LIBRARY_TARGETS@") +set(DCMTK_MODULES "@DCMTK_MODULES@") +set(DCMTK_LIBRARIES "@DCMTK_LIBRARY_TARGETS@") # Optional DCMTK 3rd party libraries -SET(DCMTK_WITH_TIFF @DCMTK_WITH_TIFF@) -SET(DCMTK_WITH_PNG @DCMTK_WITH_PNG@) -SET(DCMTK_WITH_XML @DCMTK_WITH_XML@) -SET(DCMTK_WITH_ZLIB @DCMTK_WITH_ZLIB@) -SET(DCMTK_WITH_OPENSSL @DCMTK_WITH_OPENSSL@) -SET(DCMTK_WITH_SNDFILE @DCMTK_WITH_SNDFILE@) -SET(DCMTK_WITH_ICONV @DCMTK_WITH_ICONV@) -SET(DCMTK_WITH_STDLIBC_ICONV @DCMTK_WITH_STDLIBC_ICONV@) -SET(DCMTK_WITH_ICU @DCMTK_WITH_ICU@) -SET(DCMTK_WITH_WRAP @DCMTK_WITH_WRAP@) -SET(DCMTK_WITH_DOXYGEN @DCMTK_WITH_DOXYGEN@) +set(DCMTK_WITH_TIFF @DCMTK_WITH_TIFF@) +set(DCMTK_WITH_PNG @DCMTK_WITH_PNG@) +set(DCMTK_WITH_XML @DCMTK_WITH_XML@) +set(DCMTK_WITH_ZLIB @DCMTK_WITH_ZLIB@) +set(DCMTK_WITH_OPENSSL @DCMTK_WITH_OPENSSL@) +set(DCMTK_WITH_SNDFILE @DCMTK_WITH_SNDFILE@) +set(DCMTK_WITH_ICONV @DCMTK_WITH_ICONV@) +set(DCMTK_WITH_STDLIBC_ICONV @DCMTK_WITH_STDLIBC_ICONV@) +set(DCMTK_WITH_ICU @DCMTK_WITH_ICU@) +set(DCMTK_WITH_WRAP @DCMTK_WITH_WRAP@) +set(DCMTK_WITH_DOXYGEN @DCMTK_WITH_DOXYGEN@) # Dictionary-related -SET(DCMTK_ENABLE_BUILTIN_DICTIONARY @DCMTK_ENABLE_BUILTIN_DICTIONARY@) -SET(DCMTK_ENABLE_EXTERNAL_DICTIONARY @DCMTK_ENABLE_EXTERNAL_DICTIONARY@) -SET(DCMTK_ENABLE_PRIVATE_TAGS @DCMTK_ENABLE_PRIVATE_TAGS@) +set(DCMTK_ENABLE_BUILTIN_DICTIONARY @DCMTK_ENABLE_BUILTIN_DICTIONARY@) +set(DCMTK_ENABLE_EXTERNAL_DICTIONARY @DCMTK_ENABLE_EXTERNAL_DICTIONARY@) +set(DCMTK_ENABLE_PRIVATE_TAGS @DCMTK_ENABLE_PRIVATE_TAGS@) # Compiler / standard library features -SET(DCMTK_ENABLE_CXX11 @DCMTK_ENABLE_CXX11@) -SET(DCMTK_CXX11_FLAGS @DCMTK_CXX11_FLAGS@) -SET(DCMTK_ENABLE_STL @DCMTK_ENABLE_STL@) +set(DCMTK_ENABLE_CXX11 @DCMTK_ENABLE_CXX11@) +set(DCMTK_CXX11_FLAGS @DCMTK_CXX11_FLAGS@) +set(DCMTK_ENABLE_STL @DCMTK_ENABLE_STL@) # DCMTK shared libraries -SET(DCMTK_SHARED_LIBRARIES @BUILD_SHARED_LIBS@) -SET(DCMTK_SINGLE_SHARED_LIBRARY @BUILD_SINGLE_SHARED_LIBRARY@) +set(DCMTK_SHARED_LIBRARIES @BUILD_SHARED_LIBS@) +set(DCMTK_SINGLE_SHARED_LIBRARY @BUILD_SINGLE_SHARED_LIBRARY@) # DCMTK additional options -SET(DCMTK_WITH_THREADS @DCMTK_WITH_THREADS@) -SET(DCMTK_OVERWRITE_WIN32_COMPILER_FLAGS @DCMTK_OVERWRITE_WIN32_COMPILER_FLAGS@) -SET(DCMTK_WIDE_CHAR_FILE_IO_FUNCTIONS @DCMTK_WIDE_CHAR_FILE_IO_FUNCTIONS@) -SET(DCMTK_WIDE_CHAR_MAIN_FUNCTION @DCMTK_WIDE_CHAR_MAIN_FUNCTION@) -SET(DCMTK_ENABLE_LFS @DCMTK_ENABLE_LFS@) +set(DCMTK_WITH_THREADS @DCMTK_WITH_THREADS@) +set(DCMTK_OVERWRITE_WIN32_COMPILER_FLAGS @DCMTK_OVERWRITE_WIN32_COMPILER_FLAGS@) +set(DCMTK_WIDE_CHAR_FILE_IO_FUNCTIONS @DCMTK_WIDE_CHAR_FILE_IO_FUNCTIONS@) +set(DCMTK_WIDE_CHAR_MAIN_FUNCTION @DCMTK_WIDE_CHAR_MAIN_FUNCTION@) +set(DCMTK_ENABLE_LFS @DCMTK_ENABLE_LFS@) SET_AND_CHECK(DCMTK_TARGETS "@PACKAGE_DCMTK_CMKDIR_CONFIG@/DCMTKTargets.cmake") @DCMTK_CONFIG_CODE@ # Compatibility: This variable is deprecated -SET(DCMTK_INCLUDE_DIR ${DCMTK_INCLUDE_DIRS}) +set(DCMTK_INCLUDE_DIR ${DCMTK_INCLUDE_DIRS}) -IF(NOT DCMTK_TARGETS_IMPORTED) - SET(DCMTK_TARGETS_IMPORTED 1) - INCLUDE(${DCMTK_TARGETS}) -ENDIF(NOT DCMTK_TARGETS_IMPORTED) +if(NOT DCMTK_TARGETS_IMPORTED) + set(DCMTK_TARGETS_IMPORTED 1) + include(${DCMTK_TARGETS}) +endif() diff --git a/CMake/FindCharset.cmake b/CMake/FindCharset.cmake index 85a89a0115..f779d1782d 100644 --- a/CMake/FindCharset.cmake +++ b/CMake/FindCharset.cmake @@ -4,19 +4,19 @@ # LIBCHARSET_LIBRARIES - Lists of libraries when using charset # LIBCHARSET_FOUND - True if charset found -INCLUDE(FindPackageHandleStandardArgs) +include(FindPackageHandleStandardArgs) # Look for the header file -FIND_PATH(LIBCHARSET_INCLUDE_DIR NAMES localcharset.h) -MARK_AS_ADVANCED(LIBCHARSET_INCLUDE_DIR) +find_path(LIBCHARSET_INCLUDE_DIR NAMES localcharset.h) +mark_as_advanced(LIBCHARSET_INCLUDE_DIR) -SET(LIBCHARSET_LIBS charset) -FIND_LIBRARY(LIBCHARSET_LIBRARY NAMES ${LIBCHARSET_LIBS}) -MARK_AS_ADVANCED(LIBCHARSET_LIBRARY) +set(LIBCHARSET_LIBS charset) +find_library(LIBCHARSET_LIBRARY NAMES ${LIBCHARSET_LIBS}) +mark_as_advanced(LIBCHARSET_LIBRARY) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBCHARSET REQUIRED_VARS LIBCHARSET_LIBRARY LIBCHARSET_INCLUDE_DIR) -IF(LIBCHARSET_FOUND) - SET(LIBCHARSET_INCLUDE_DIRS ${LIBCHARSET_INCLUDE_DIR}) - SET(LIBCHARSET_LIBRARIES ${LIBCHARSET_LIBRARY}) -ENDIF(LIBCHARSET_FOUND) +if(LIBCHARSET_FOUND) + set(LIBCHARSET_INCLUDE_DIRS ${LIBCHARSET_INCLUDE_DIR}) + set(LIBCHARSET_LIBRARIES ${LIBCHARSET_LIBRARY}) +endif() diff --git a/CMake/FindICONV.cmake b/CMake/FindICONV.cmake index f010b794c9..379ec09995 100644 --- a/CMake/FindICONV.cmake +++ b/CMake/FindICONV.cmake @@ -6,28 +6,28 @@ # LIBICONV_LIBRARIES - Lists of libraries when using iconv # LIBICONV_FOUND - True if iconv found -INCLUDE(FindPackageHandleStandardArgs) -INCLUDE(dcmtkTryCompile) +include(FindPackageHandleStandardArgs) +include(dcmtkTryCompile) # Look for the header file -FIND_PATH(LIBICONV_INCLUDE_DIR NAMES iconv.h) -MARK_AS_ADVANCED(LIBICONV_INCLUDE_DIR) +find_path(LIBICONV_INCLUDE_DIR NAMES iconv.h) +mark_as_advanced(LIBICONV_INCLUDE_DIR) # Look for the library -SET(LIBICONV_LIBS iconv) -FIND_LIBRARY(LIBICONV_LIBRARY NAMES ${LIBICONV_LIBS}) -MARK_AS_ADVANCED(LIBICONV_LIBRARY) +set(LIBICONV_LIBS iconv) +find_library(LIBICONV_LIBRARY NAMES ${LIBICONV_LIBS}) +mark_as_advanced(LIBICONV_LIBRARY) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBICONV REQUIRED_VARS LIBICONV_LIBRARY LIBICONV_INCLUDE_DIR) # Copy the result to output variables -IF(LIBICONV_FOUND) - SET(LIBICONV_LIBRARIES ${LIBICONV_LIBRARY}) - SET(LIBICONV_INCLUDE_DIRS ${LIBICONV_INCLUDE_DIR}) -ELSE(LIBICONV_FOUND) - SET(LIBICONV_LIBS) - SET(LIBICONV_LIBRARY) - SET(LIBICONV_LIBRARIES) - SET(LIBICONV_INCLUDE_DIR) - SET(LIBICONV_INCLUDE_DIRS) -ENDIF(LIBICONV_FOUND) +if(LIBICONV_FOUND) + set(LIBICONV_LIBRARIES ${LIBICONV_LIBRARY}) + set(LIBICONV_INCLUDE_DIRS ${LIBICONV_INCLUDE_DIR}) +else() + set(LIBICONV_LIBS) + set(LIBICONV_LIBRARY) + set(LIBICONV_LIBRARIES) + set(LIBICONV_INCLUDE_DIR) + set(LIBICONV_INCLUDE_DIRS) +endif() diff --git a/CMake/FindICU.cmake b/CMake/FindICU.cmake index 59dd891afa..68045c9a1d 100644 --- a/CMake/FindICU.cmake +++ b/CMake/FindICU.cmake @@ -39,7 +39,7 @@ # target_link_libraries(myapp ${ICU_LIBRARIES}) # # with CMake >= 3.0.0, the last two lines can be replaced by the following # target_link_libraries(myapp ICU::ICU) -# endif(ICU_FOUND) +# endif() ########## ########## @@ -48,13 +48,13 @@ find_package(PkgConfig QUIET) ########## Private ########## if(NOT DEFINED ICU_PUBLIC_VAR_NS) set(ICU_PUBLIC_VAR_NS "ICU") # Prefix for all ICU relative public variables -endif(NOT DEFINED ICU_PUBLIC_VAR_NS) +endif() if(NOT DEFINED ICU_PRIVATE_VAR_NS) set(ICU_PRIVATE_VAR_NS "_${ICU_PUBLIC_VAR_NS}") # Prefix for all ICU relative internal variables -endif(NOT DEFINED ICU_PRIVATE_VAR_NS) +endif() if(NOT DEFINED PC_ICU_PRIVATE_VAR_NS) set(PC_ICU_PRIVATE_VAR_NS "_PC${ICU_PRIVATE_VAR_NS}") # Prefix for all pkg-config relative internal variables -endif(NOT DEFINED PC_ICU_PRIVATE_VAR_NS) +endif() set(${ICU_PRIVATE_VAR_NS}_HINTS ) # @@ -62,25 +62,25 @@ set(${ICU_PRIVATE_VAR_NS}_HINTS ) if(DEFINED ENV{ICU_ROOT}) list(APPEND ${ICU_PRIVATE_VAR_NS}_HINTS "$ENV{ICU_ROOT}") message(AUTHOR_WARNING "ENV{ICU_ROOT} is deprecated in favor of ENV{ICU_ROOT_DIR}") -endif(DEFINED ENV{ICU_ROOT}) +endif() if (DEFINED ICU_ROOT) list(APPEND ${ICU_PRIVATE_VAR_NS}_HINTS "${ICU_ROOT}") message(AUTHOR_WARNING "ICU_ROOT is deprecated in favor of ICU_ROOT_DIR") -endif(DEFINED ICU_ROOT) +endif() # if(DEFINED ENV{ICU_ROOT_DIR}) list(APPEND ${ICU_PRIVATE_VAR_NS}_HINTS "$ENV{ICU_ROOT_DIR}") -endif(DEFINED ENV{ICU_ROOT_DIR}) +endif() if (DEFINED ICU_ROOT_DIR) list(APPEND ${ICU_PRIVATE_VAR_NS}_HINTS "${ICU_ROOT_DIR}") -endif(DEFINED ICU_ROOT_DIR) +endif() set(${ICU_PRIVATE_VAR_NS}_COMPONENTS ) # ... macro(_icu_declare_component _NAME) list(APPEND ${ICU_PRIVATE_VAR_NS}_COMPONENTS ${_NAME}) set("${ICU_PRIVATE_VAR_NS}_COMPONENTS_${_NAME}" ${ARGN}) -endmacro(_icu_declare_component) +endmacro() _icu_declare_component(data icudata) _icu_declare_component(uc icuuc) # Common and Data libraries @@ -103,20 +103,20 @@ set(${ICU_PUBLIC_VAR_NS}_CPP_SHARED_FLAGS "") foreach(${ICU_PRIVATE_VAR_NS}_COMPONENT ${${ICU_PRIVATE_VAR_NS}_COMPONENTS}) string(TOUPPER "${${ICU_PRIVATE_VAR_NS}_COMPONENT}" ${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT) set("${ICU_PUBLIC_VAR_NS}_${${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT}_FOUND" FALSE) # may be done in the _icu_declare_component macro -endforeach(${ICU_PRIVATE_VAR_NS}_COMPONENT) +endforeach() # Check components if(NOT ${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS) # uc required at least set(${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS uc) -else(NOT ${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS) +else() list(APPEND ${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS uc) list(REMOVE_DUPLICATES ${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS) foreach(${ICU_PRIVATE_VAR_NS}_COMPONENT ${${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS}) if(NOT DEFINED ${ICU_PRIVATE_VAR_NS}_COMPONENTS_${${ICU_PRIVATE_VAR_NS}_COMPONENT}) message(FATAL_ERROR "Unknown ICU component: ${${ICU_PRIVATE_VAR_NS}_COMPONENT}") - endif(NOT DEFINED ${ICU_PRIVATE_VAR_NS}_COMPONENTS_${${ICU_PRIVATE_VAR_NS}_COMPONENT}) - endforeach(${ICU_PRIVATE_VAR_NS}_COMPONENT) -endif(NOT ${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS) + endif() + endforeach() +endif() # if pkg-config is available check components dependencies and append `pkg-config icu- --variable=prefix` to hints if(PKG_CONFIG_FOUND) @@ -133,12 +133,12 @@ if(PKG_CONFIG_FOUND) if(${ICU_PRIVATE_VAR_NS}_COMPONENT_INDEX EQUAL -1) message(WARNING "Missing component dependency: ${${PC_ICU_PRIVATE_VAR_NS}_STRIPPED_LIBRARY}. Add it to your find_package(ICU) line as COMPONENTS to fix this warning.") list(APPEND ${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS ${${PC_ICU_PRIVATE_VAR_NS}_STRIPPED_LIBRARY}) - endif(${ICU_PRIVATE_VAR_NS}_COMPONENT_INDEX EQUAL -1) - endif(NOT ${PC_ICU_PRIVATE_VAR_NS}_STRIPPED_LIBRARY STREQUAL "data") - endforeach(${PC_ICU_PRIVATE_VAR_NS}_LIBRARY) - endif(${PC_ICU_PRIVATE_VAR_NS}_FOUND) - endforeach(${ICU_PRIVATE_VAR_NS}_COMPONENT) -endif(PKG_CONFIG_FOUND) + endif() + endif() + endforeach() + endif() + endforeach() +endif() # list(APPEND ${ICU_PRIVATE_VAR_NS}_HINTS ENV ICU_ROOT_DIR) # message("${ICU_PRIVATE_VAR_NS}_HINTS = ${${ICU_PRIVATE_VAR_NS}_HINTS}") @@ -196,12 +196,12 @@ if(${ICU_PUBLIC_VAR_NS}_INCLUDE_DIR) endif() set(${ICU_PUBLIC_VAR_NS}_VERSION "${${ICU_PUBLIC_VAR_NS}_VERSION_MAJOR}.${${ICU_PUBLIC_VAR_NS}_VERSION_MINOR}.${${ICU_PUBLIC_VAR_NS}_VERSION_PATCH}") ########## ########## -endif(${ICU_PUBLIC_VAR_NS}_INCLUDE_DIR) +endif() # Check libraries if(MSVC) include(SelectLibraryConfigurations) -endif(MSVC) +endif() foreach(${ICU_PRIVATE_VAR_NS}_COMPONENT ${${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS}) string(TOUPPER "${${ICU_PRIVATE_VAR_NS}_COMPONENT}" ${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT) if(MSVC) @@ -212,7 +212,7 @@ foreach(${ICU_PRIVATE_VAR_NS}_COMPONENT ${${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS}) list(APPEND ${ICU_PRIVATE_VAR_NS}_POSSIBLE_DEBUG_NAMES "${${ICU_PRIVATE_VAR_NS}_BASE_NAME}d") list(APPEND ${ICU_PRIVATE_VAR_NS}_POSSIBLE_RELEASE_NAMES "${${ICU_PRIVATE_VAR_NS}_BASE_NAME}${${ICU_PUBLIC_VAR_NS}_VERSION_MAJOR}${${ICU_PUBLIC_VAR_NS}_VERSION_MINOR}") list(APPEND ${ICU_PRIVATE_VAR_NS}_POSSIBLE_DEBUG_NAMES "${${ICU_PRIVATE_VAR_NS}_BASE_NAME}${${ICU_PUBLIC_VAR_NS}_VERSION_MAJOR}${${ICU_PUBLIC_VAR_NS}_VERSION_MINOR}d") - endforeach(${ICU_PRIVATE_VAR_NS}_BASE_NAME) + endforeach() find_library( ${ICU_PUBLIC_VAR_NS}_${${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT}_LIBRARY_RELEASE @@ -229,7 +229,7 @@ foreach(${ICU_PRIVATE_VAR_NS}_COMPONENT ${${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS}) select_library_configurations("${ICU_PUBLIC_VAR_NS}_${${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT}") list(APPEND ${ICU_PUBLIC_VAR_NS}_LIBRARY ${${ICU_PUBLIC_VAR_NS}_${${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT}_LIBRARY}) - else(MSVC) + else() find_library( ${ICU_PUBLIC_VAR_NS}_${${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT}_LIBRARY NAMES ${${ICU_PRIVATE_VAR_NS}_COMPONENTS_${${ICU_PRIVATE_VAR_NS}_COMPONENT}} @@ -240,9 +240,9 @@ foreach(${ICU_PRIVATE_VAR_NS}_COMPONENT ${${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS}) if(${ICU_PUBLIC_VAR_NS}_${${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT}_LIBRARY) set("${ICU_PUBLIC_VAR_NS}_${${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT}_FOUND" TRUE) list(APPEND ${ICU_PUBLIC_VAR_NS}_LIBRARY ${${ICU_PUBLIC_VAR_NS}_${${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT}_LIBRARY}) - endif(${ICU_PUBLIC_VAR_NS}_${${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT}_LIBRARY) - endif(MSVC) -endforeach(${ICU_PRIVATE_VAR_NS}_COMPONENT) + endif() + endif() +endforeach() # Try to find out compiler flags find_program(${ICU_PUBLIC_VAR_NS}_CONFIG_EXECUTABLE icu-config HINTS ${${ICU_PRIVATE_VAR_NS}_HINTS}) @@ -254,7 +254,7 @@ if(${ICU_PUBLIC_VAR_NS}_CONFIG_EXECUTABLE) execute_process(COMMAND ${${ICU_PUBLIC_VAR_NS}_CONFIG_EXECUTABLE} --cflags-dynamic OUTPUT_VARIABLE ${ICU_PUBLIC_VAR_NS}_C_SHARED_FLAGS OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND ${${ICU_PUBLIC_VAR_NS}_CONFIG_EXECUTABLE} --cxxflags-dynamic OUTPUT_VARIABLE ${ICU_PUBLIC_VAR_NS}_CXX_SHARED_FLAGS OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND ${${ICU_PUBLIC_VAR_NS}_CONFIG_EXECUTABLE} --cppflags-dynamic OUTPUT_VARIABLE ${ICU_PUBLIC_VAR_NS}_CPP_SHARED_FLAGS OUTPUT_STRIP_TRAILING_WHITESPACE) -endif(${ICU_PUBLIC_VAR_NS}_CONFIG_EXECUTABLE) +endif() # Check find_package arguments include(FindPackageHandleStandardArgs) @@ -264,9 +264,9 @@ if(${ICU_PUBLIC_VAR_NS}_FIND_REQUIRED AND NOT ${ICU_PUBLIC_VAR_NS}_FIND_QUIETLY) REQUIRED_VARS ${ICU_PUBLIC_VAR_NS}_LIBRARY ${ICU_PUBLIC_VAR_NS}_INCLUDE_DIR VERSION_VAR ${ICU_PUBLIC_VAR_NS}_VERSION ) -else(${ICU_PUBLIC_VAR_NS}_FIND_REQUIRED AND NOT ${ICU_PUBLIC_VAR_NS}_FIND_QUIETLY) +else() find_package_handle_standard_args(${ICU_PUBLIC_VAR_NS} "Could NOT find ICU" ${ICU_PUBLIC_VAR_NS}_LIBRARY ${ICU_PUBLIC_VAR_NS}_INCLUDE_DIR) -endif(${ICU_PUBLIC_VAR_NS}_FIND_REQUIRED AND NOT ${ICU_PUBLIC_VAR_NS}_FIND_QUIETLY) +endif() if(${ICU_PUBLIC_VAR_NS}_FOUND) # @@ -281,7 +281,7 @@ if(${ICU_PUBLIC_VAR_NS}_FOUND) if(NOT CMAKE_VERSION VERSION_LESS "3.0.0") if(NOT TARGET ICU::ICU) add_library(ICU::ICU INTERFACE IMPORTED) - endif(NOT TARGET ICU::ICU) + endif() set_target_properties(ICU::ICU PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${${ICU_PUBLIC_VAR_NS}_INCLUDE_DIR}") foreach(${ICU_PRIVATE_VAR_NS}_COMPONENT ${${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS}) string(TOUPPER "${${ICU_PRIVATE_VAR_NS}_COMPONENT}" ${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT) @@ -289,19 +289,19 @@ if(${ICU_PUBLIC_VAR_NS}_FOUND) if(${ICU_PUBLIC_VAR_NS}_${${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT}_LIBRARY_RELEASE) set_property(TARGET "ICU::${${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT}" APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) set_target_properties("ICU::${${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT}" PROPERTIES IMPORTED_LOCATION_RELEASE "${${ICU_PUBLIC_VAR_NS}_${${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT}_LIBRARY_RELEASE}") - endif(${ICU_PUBLIC_VAR_NS}_${${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT}_LIBRARY_RELEASE) + endif() if(${ICU_PUBLIC_VAR_NS}_${${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT}_LIBRARY_DEBUG) set_property(TARGET "ICU::${${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT}" APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) set_target_properties("ICU::${${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT}" PROPERTIES IMPORTED_LOCATION_DEBUG "${${ICU_PUBLIC_VAR_NS}_${${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT}_LIBRARY_DEBUG}") - endif(${ICU_PUBLIC_VAR_NS}_${${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT}_LIBRARY_DEBUG) + endif() if(${ICU_PUBLIC_VAR_NS}_${${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT}_LIBRARY) set_target_properties("ICU::${${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT}" PROPERTIES IMPORTED_LOCATION "${${ICU_PUBLIC_VAR_NS}_${${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT}_LIBRARY}") - endif(${ICU_PUBLIC_VAR_NS}_${${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT}_LIBRARY) + endif() set_property(TARGET ICU::ICU APPEND PROPERTY INTERFACE_LINK_LIBRARIES "ICU::${${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT}") # set_target_properties("ICU::${${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT}" PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${${ICU_PUBLIC_VAR_NS}_INCLUDE_DIR}") - endforeach(${ICU_PRIVATE_VAR_NS}_COMPONENT) - endif(NOT CMAKE_VERSION VERSION_LESS "3.0.0") -endif(${ICU_PUBLIC_VAR_NS}_FOUND) + endforeach() + endif() +endif() mark_as_advanced( ${ICU_PUBLIC_VAR_NS}_INCLUDE_DIR @@ -319,7 +319,7 @@ function(_icu_extract_locale_from_rb _BUNDLE_SOURCE _RETURN_VAR_NAME) string(REGEX REPLACE "[ \t\n]" "" _BUNDLE_CONTENTS_WITHOUT_COMMENTS_AND_SPACES ${_BUNDLE_CONTENTS_WITHOUT_COMMENTS}) string(REGEX MATCH "^([a-zA-Z_-]+)(:table)?{" LOCALE_FOUND ${_BUNDLE_CONTENTS_WITHOUT_COMMENTS_AND_SPACES}) set("${_RETURN_VAR_NAME}" "${CMAKE_MATCH_1}" PARENT_SCOPE) -endfunction(_icu_extract_locale_from_rb) +endfunction() ########## Public ########## @@ -376,10 +376,10 @@ function(icu_generate_resource_bundle) if(NOT ${ICU_PUBLIC_VAR_NS}_GENRB_EXECUTABLE) message(FATAL_ERROR "genrb not found") - endif(NOT ${ICU_PUBLIC_VAR_NS}_GENRB_EXECUTABLE) + endif() if(NOT ${ICU_PUBLIC_VAR_NS}_PKGDATA_EXECUTABLE) message(FATAL_ERROR "pkgdata not found") - endif(NOT ${ICU_PUBLIC_VAR_NS}_PKGDATA_EXECUTABLE) + endif() ##### ##### ##### ##### @@ -434,40 +434,40 @@ function(icu_generate_resource_bundle) # assert(${PARSED_ARGS_NAME} != "") if(NOT PARSED_ARGS_NAME) message(FATAL_ERROR "${__FUNCTION__}(): no name given, NAME parameter missing") - endif(NOT PARSED_ARGS_NAME) + endif() # assert(length(PARSED_ARGS_FILES) > 0) list(LENGTH PARSED_ARGS_FILES PARSED_ARGS_FILES_LEN) if(PARSED_ARGS_FILES_LEN LESS 1) message(FATAL_ERROR "${__FUNCTION__}() expects at least 1 resource bundle as FILES argument, 0 given") - endif(PARSED_ARGS_FILES_LEN LESS 1) + endif() string(TOUPPER "${PARSED_ARGS_FORMAT}" UPPER_FORMAT) # assert(${UPPER_FORMAT} in ['', 'java', 'xlif']) if(NOT DEFINED BUNDLES_${UPPER_FORMAT}_SUFFIX) message(FATAL_ERROR "${__FUNCTION__}(): unknown FORMAT '${PARSED_ARGS_FORMAT}'") - endif(NOT DEFINED BUNDLES_${UPPER_FORMAT}_SUFFIX) + endif() if(UPPER_FORMAT STREQUAL "JAVA") # assert(${PARSED_ARGS_BUNDLE} != "") if(NOT PARSED_ARGS_BUNDLE) message(FATAL_ERROR "${__FUNCTION__}(): java bundle name expected, BUNDLE parameter missing") - endif(NOT PARSED_ARGS_BUNDLE) - endif(UPPER_FORMAT STREQUAL "JAVA") + endif() + endif() if(PARSED_ARGS_PACKAGE) # assert(${PARSED_ARGS_FORMAT} == "") if(PARSED_ARGS_FORMAT) message(FATAL_ERROR "${__FUNCTION__}(): packaging is only supported for binary format, not xlif neither java outputs") - endif(PARSED_ARGS_FORMAT) + endif() string(TOUPPER "${PARSED_ARGS_TYPE}" UPPER_MODE) # assert(${UPPER_MODE} in ['', 'common', 'archive', 'dll', library']) if(NOT DEFINED PKGDATA_${UPPER_MODE}_ALIAS) message(FATAL_ERROR "${__FUNCTION__}(): unknown TYPE '${PARSED_ARGS_TYPE}'") - else(NOT DEFINED PKGDATA_${UPPER_MODE}_ALIAS) + else() set(TYPE "${PKGDATA_${UPPER_MODE}_ALIAS}") - endif(NOT DEFINED PKGDATA_${UPPER_MODE}_ALIAS) + endif() # Package name: strip file extension if present get_filename_component(PACKAGE_NAME_WE ${PARSED_ARGS_NAME} NAME_WE) @@ -479,25 +479,25 @@ function(icu_generate_resource_bundle) # We make our "cook" there to prevent any conflict if(DEFINED CMAKE_PLATFORM_ROOT_BIN) # CMake < 2.8.10 set(RESOURCE_GENRB_CHDIR_DIR "${CMAKE_PLATFORM_ROOT_BIN}/${PACKAGE_TARGET_NAME}.dir/") - else(DEFINED CMAKE_PLATFORM_ROOT_BIN) # CMake >= 2.8.10 + else() # CMake >= 2.8.10 set(RESOURCE_GENRB_CHDIR_DIR "${CMAKE_PLATFORM_INFO_DIR}/${PACKAGE_TARGET_NAME}.dir/") - endif(DEFINED CMAKE_PLATFORM_ROOT_BIN) + endif() # Directory (absolute) where resource bundles are built: concatenation of RESOURCE_GENRB_CHDIR_DIR and package name set(RESOURCE_OUTPUT_DIR "${RESOURCE_GENRB_CHDIR_DIR}/${PACKAGE_NAME_WE}/") # Output (relative) path for built package if(MSVC AND TYPE STREQUAL PKGDATA_LIBRARY_ALIAS) set(PACKAGE_OUTPUT_PATH "${RESOURCE_GENRB_CHDIR_DIR}/${PACKAGE_NAME_WE}/${PKGDATA_${TYPE}_PREFIX}${PACKAGE_NAME_WE}${PKGDATA_${TYPE}_SUFFIX}") - else(MSVC AND TYPE STREQUAL PKGDATA_LIBRARY_ALIAS) + else() set(PACKAGE_OUTPUT_PATH "${RESOURCE_GENRB_CHDIR_DIR}/${PKGDATA_${TYPE}_PREFIX}${PACKAGE_NAME_WE}${PKGDATA_${TYPE}_SUFFIX}") - endif(MSVC AND TYPE STREQUAL PKGDATA_LIBRARY_ALIAS) + endif() # Output (absolute) path for the list file set(PACKAGE_LIST_OUTPUT_PATH "${RESOURCE_GENRB_CHDIR_DIR}/pkglist.txt") file(MAKE_DIRECTORY "${RESOURCE_OUTPUT_DIR}") - else(PARSED_ARGS_PACKAGE) + else() set(RESOURCE_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/") # set(RESOURCE_GENRB_CHDIR_DIR "UNUSED") - endif(PARSED_ARGS_PACKAGE) + endif() set(TARGET_RESOURCES ) set(COMPILED_RESOURCES_PATH ) @@ -510,10 +510,10 @@ function(icu_generate_resource_bundle) if(UPPER_FORMAT STREQUAL "XLIFF") if(RESOURCE_NAME_WE STREQUAL "root") set(XLIFF_LANGUAGE "en") - else(RESOURCE_NAME_WE STREQUAL "root") + else() string(REGEX REPLACE "[^a-z].*$" "" XLIFF_LANGUAGE "${RESOURCE_NAME_WE}") - endif(RESOURCE_NAME_WE STREQUAL "root") - endif(UPPER_FORMAT STREQUAL "XLIFF") + endif() + endif() ##### ##### set(RESOURCE_TARGET_NAME "${RESOURCE_TARGET_PREFIX}${TARGET_SEPARATOR}${PARSED_ARGS_NAME}${TARGET_SEPARATOR}${RESOURCE_NAME_WE}") @@ -521,9 +521,9 @@ function(icu_generate_resource_bundle) set(RESOURCE_OUTPUT__PATH "${RESOURCE_NAME_WE}.res") if(RESOURCE_NAME_WE STREQUAL "root") set(RESOURCE_OUTPUT_JAVA_PATH "${PARSED_ARGS_BUNDLE}.java") - else(RESOURCE_NAME_WE STREQUAL "root") + else() set(RESOURCE_OUTPUT_JAVA_PATH "${PARSED_ARGS_BUNDLE}_${RESOURCE_NAME_WE}.java") - endif(RESOURCE_NAME_WE STREQUAL "root") + endif() set(RESOURCE_OUTPUT_XLIFF_PATH "${RESOURCE_NAME_WE}.xlf") set(GENRB__OPTIONS "") @@ -538,13 +538,13 @@ function(icu_generate_resource_bundle) COMMAND ${CMAKE_COMMAND} -E chdir ${RESOURCE_GENRB_CHDIR_DIR} ${${ICU_PUBLIC_VAR_NS}_GENRB_EXECUTABLE} ${GENRB_${UPPER_FORMAT}_OPTIONS} -d ${PACKAGE_NAME_WE} ${ABSOLUTE_SOURCE} DEPENDS ${RESOURCE_SOURCE} ) - else(PARSED_ARGS_PACKAGE) + else() add_custom_command( OUTPUT "${RESOURCE_OUTPUT_DIR}${RESOURCE_OUTPUT_${UPPER_FORMAT}_PATH}" COMMAND ${${ICU_PUBLIC_VAR_NS}_GENRB_EXECUTABLE} ${GENRB_${UPPER_FORMAT}_OPTIONS} -d ${RESOURCE_OUTPUT_DIR} ${ABSOLUTE_SOURCE} DEPENDS ${RESOURCE_SOURCE} ) - endif(PARSED_ARGS_PACKAGE) + endif() # dummy target (ICU+RB++) for each locale to build the .res file from its .txt by the add_custom_command above add_custom_target( "${RESOURCE_TARGET_NAME}" ALL @@ -555,12 +555,12 @@ function(icu_generate_resource_bundle) if(PARSED_ARGS_DESTINATION AND NOT PARSED_ARGS_PACKAGE) install(FILES "${RESOURCE_OUTPUT_DIR}${RESOURCE_OUTPUT_${UPPER_FORMAT}_PATH}" DESTINATION ${PARSED_ARGS_DESTINATION} PERMISSIONS OWNER_READ GROUP_READ WORLD_READ) - endif(PARSED_ARGS_DESTINATION AND NOT PARSED_ARGS_PACKAGE) + endif() list(APPEND TARGET_RESOURCES "${RESOURCE_TARGET_NAME}") list(APPEND COMPILED_RESOURCES_PATH "${RESOURCE_OUTPUT_DIR}${RESOURCE_OUTPUT_${UPPER_FORMAT}_PATH}") list(APPEND COMPILED_RESOURCES_BASENAME "${RESOURCE_NAME_WE}.${BUNDLES_${UPPER_FORMAT}_SUFFIX}") - endforeach(RESOURCE_SOURCE) + endforeach() # convert semicolon separated list to a space separated list # NOTE: if the pkglist.txt file starts (or ends?) with a whitespace, pkgdata add an undefined symbol (named _) for it string(REPLACE ";" " " COMPILED_RESOURCES_BASENAME "${COMPILED_RESOURCES_BASENAME}") @@ -583,14 +583,14 @@ function(icu_generate_resource_bundle) # assert(${PARSED_ARGS_DEPENDS} != "") if(NOT PARSED_ARGS_DEPENDS) message(FATAL_ERROR "${__FUNCTION__}(): static and library mode imply a list of targets to link to, DEPENDS parameter missing") - endif(NOT PARSED_ARGS_DEPENDS) + endif() add_library(${PACKAGE_TARGET_NAME} ${PKGDATA_LIBRARY_${TYPE}_TYPE} IMPORTED) if(MSVC) string(REGEX REPLACE "${PKGDATA_LIBRARY_SUFFIX}\$" "${CMAKE_IMPORT_LIBRARY_SUFFIX}" PACKAGE_OUTPUT_LIB "${PACKAGE_OUTPUT_PATH}") set_target_properties(${PACKAGE_TARGET_NAME} PROPERTIES IMPORTED_LOCATION ${PACKAGE_OUTPUT_PATH} IMPORTED_IMPLIB ${PACKAGE_OUTPUT_LIB}) - else(MSVC) + else() set_target_properties(${PACKAGE_TARGET_NAME} PROPERTIES IMPORTED_LOCATION ${PACKAGE_OUTPUT_PATH}) - endif(MSVC) + endif() foreach(DEPENDENCY ${PARSED_ARGS_DEPENDS}) target_link_libraries(${DEPENDENCY} ${PACKAGE_TARGET_NAME}) if(NOT PARSED_ARGS_NO_SHARED_FLAGS) @@ -598,11 +598,11 @@ function(icu_generate_resource_bundle) list(LENGTH "${ENABLED_LANGUAGES}" ENABLED_LANGUAGES_LENGTH) if(ENABLED_LANGUAGES_LENGTH GREATER 1) message(WARNING "Project has more than one language enabled, skip automatic shared flags appending") - else(ENABLED_LANGUAGES_LENGTH GREATER 1) + else() set_property(TARGET "${DEPENDENCY}" APPEND PROPERTY COMPILE_FLAGS "${${ICU_PUBLIC_VAR_NS}_${ENABLED_LANGUAGES}_SHARED_FLAGS}") - endif(ENABLED_LANGUAGES_LENGTH GREATER 1) - endif(NOT PARSED_ARGS_NO_SHARED_FLAGS) - endforeach(DEPENDENCY) + endif() + endif() + endforeach() # http://www.mail-archive.com/cmake-commits@cmake.org/msg01135.html set(PACKAGE_INTERMEDIATE_TARGET_NAME "${PACKAGE_TARGET_NAME}${TARGET_SEPARATOR}DUMMY") # dummy intermediate target (ICU+PKG++DUMMY) to link the package to the produced library by running pkgdata (see add_custom_command above) @@ -612,14 +612,14 @@ function(icu_generate_resource_bundle) DEPENDS "${PACKAGE_OUTPUT_PATH}" ) add_dependencies("${PACKAGE_TARGET_NAME}" "${PACKAGE_INTERMEDIATE_TARGET_NAME}") - else(PKGDATA_LIBRARY_${TYPE}_TYPE) + else() # dummy target (ICU+PKG+) to run pkgdata (see add_custom_command above) add_custom_target( "${PACKAGE_TARGET_NAME}" ALL COMMENT "" DEPENDS "${PACKAGE_OUTPUT_PATH}" ) - endif(PKGDATA_LIBRARY_${TYPE}_TYPE) + endif() # dummy target (ICU+PKG++PKGLIST) to build the file pkglist.txt add_custom_target( "${PACKAGE_LIST_TARGET_NAME}" ALL @@ -633,10 +633,10 @@ function(icu_generate_resource_bundle) if(PARSED_ARGS_DESTINATION) install(FILES "${PACKAGE_OUTPUT_PATH}" DESTINATION ${PARSED_ARGS_DESTINATION} PERMISSIONS OWNER_READ GROUP_READ WORLD_READ) - endif(PARSED_ARGS_DESTINATION) - endif(PARSED_ARGS_PACKAGE) + endif() + endif() -endfunction(icu_generate_resource_bundle) +endfunction() ########## ########## @@ -647,10 +647,10 @@ if(${ICU_PUBLIC_VAR_NS}_DEBUG) function(icudebug _VARNAME) if(DEFINED ${ICU_PUBLIC_VAR_NS}_${_VARNAME}) message("${ICU_PUBLIC_VAR_NS}_${_VARNAME} = ${${ICU_PUBLIC_VAR_NS}_${_VARNAME}}") - else(DEFINED ${ICU_PUBLIC_VAR_NS}_${_VARNAME}) + else() message("${ICU_PUBLIC_VAR_NS}_${_VARNAME} = ") - endif(DEFINED ${ICU_PUBLIC_VAR_NS}_${_VARNAME}) - endfunction(icudebug) + endif() + endfunction() # IN (args) icudebug("FIND_COMPONENTS") @@ -682,9 +682,9 @@ if(${ICU_PUBLIC_VAR_NS}_DEBUG) string(TOUPPER "${${ICU_PRIVATE_VAR_NS}_COMPONENT}" ${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT) foreach(${ICU_PRIVATE_VAR_NS}_COMPONENT_VARIABLE ${${ICU_PRIVATE_VAR_NS}_COMPONENT_VARIABLES}) icudebug("${${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT}_${${ICU_PRIVATE_VAR_NS}_COMPONENT_VARIABLE}") - endforeach(${ICU_PRIVATE_VAR_NS}_COMPONENT_VARIABLE) - endforeach(${ICU_PRIVATE_VAR_NS}_COMPONENT) + endforeach() + endforeach() -endif(${ICU_PUBLIC_VAR_NS}_DEBUG) +endif() ########## ########## diff --git a/CMake/FindSndfile.cmake b/CMake/FindSndfile.cmake index b1d12148fa..ca5e8c33bd 100644 --- a/CMake/FindSndfile.cmake +++ b/CMake/FindSndfile.cmake @@ -6,27 +6,27 @@ # SNDFILE_LIBRARIES - Lists of libraries when using sndfile # SNDFILE_FOUND - True if sndfile found -INCLUDE(FindPackageHandleStandardArgs) +include(FindPackageHandleStandardArgs) # Look for the header file -FIND_PATH(SNDFILE_INCLUDE_DIR NAMES sndfile.h) -MARK_AS_ADVANCED(SNDFILE_INCLUDE_DIR) +find_path(SNDFILE_INCLUDE_DIR NAMES sndfile.h) +mark_as_advanced(SNDFILE_INCLUDE_DIR) # Look for the library -SET(SNDFILE_LIBS sndfile) -FIND_LIBRARY(SNDFILE_LIBRARY NAMES ${SNDFILE_LIBS}) -MARK_AS_ADVANCED(SNDFILE_LIBRARY) +set(SNDFILE_LIBS sndfile) +find_library(SNDFILE_LIBRARY NAMES ${SNDFILE_LIBS}) +mark_as_advanced(SNDFILE_LIBRARY) FIND_PACKAGE_HANDLE_STANDARD_ARGS(SNDFILE REQUIRED_VARS SNDFILE_LIBRARY SNDFILE_INCLUDE_DIR) # Copy the result to output variables -IF(SNDFILE_FOUND) - SET(SNDFILE_LIBRARIES ${SNDFILE_LIBRARY}) - SET(SNDFILE_INCLUDE_DIRS ${SNDFILE_INCLUDE_DIR}) -ELSE(SNDFILE_FOUND) - SET(SNDFILE_LIBS) - SET(SNDFILE_LIBRARY) - SET(SNDFILE_LIBRARIES) - SET(SNDFILE_INCLUDE_DIR) - SET(SNDFILE_INCLUDE_DIRS) -ENDIF(SNDFILE_FOUND) +if(SNDFILE_FOUND) + set(SNDFILE_LIBRARIES ${SNDFILE_LIBRARY}) + set(SNDFILE_INCLUDE_DIRS ${SNDFILE_INCLUDE_DIR}) +else() + set(SNDFILE_LIBS) + set(SNDFILE_LIBRARY) + set(SNDFILE_LIBRARIES) + set(SNDFILE_INCLUDE_DIR) + set(SNDFILE_INCLUDE_DIRS) +endif() diff --git a/CMake/FindWrap.cmake b/CMake/FindWrap.cmake index 5737e418ed..27955bf013 100644 --- a/CMake/FindWrap.cmake +++ b/CMake/FindWrap.cmake @@ -6,27 +6,27 @@ # WRAP_LIBRARIES - Lists of libraries when using libwrap # WRAP_FOUND - True if wrap found -INCLUDE(FindPackageHandleStandardArgs) +include(FindPackageHandleStandardArgs) # Look for the header file -FIND_PATH(WRAP_INCLUDE_DIR NAMES tcpd.h) -MARK_AS_ADVANCED(WRAP_INCLUDE_DIR) +find_path(WRAP_INCLUDE_DIR NAMES tcpd.h) +mark_as_advanced(WRAP_INCLUDE_DIR) # Look for the library -SET(WRAP_LIBS wrap) -FIND_LIBRARY(WRAP_LIBRARY NAMES ${WRAP_LIBS}) -MARK_AS_ADVANCED(WRAP_LIBRARY) +set(WRAP_LIBS wrap) +find_library(WRAP_LIBRARY NAMES ${WRAP_LIBS}) +mark_as_advanced(WRAP_LIBRARY) FIND_PACKAGE_HANDLE_STANDARD_ARGS(WRAP REQUIRED_VARS WRAP_LIBRARY WRAP_INCLUDE_DIR) # Copy the result to output variables -IF(WRAP_FOUND) - SET(WRAP_LIBRARIES ${WRAP_LIBRARY}) - SET(WRAP_INCLUDE_DIRS ${WRAP_INCLUDE_DIR}) -ELSE(WRAP_FOUND) - SET(WRAP_LIBS) - SET(WRAP_LIBRARY) - SET(WRAP_LIBRARIES) - SET(WRAP_INCLUDE_DIR) - SET(WRAP_INCLUDE_DIRS) -ENDIF(WRAP_FOUND) +if(WRAP_FOUND) + set(WRAP_LIBRARIES ${WRAP_LIBRARY}) + set(WRAP_INCLUDE_DIRS ${WRAP_INCLUDE_DIR}) +else() + set(WRAP_LIBS) + set(WRAP_LIBRARY) + set(WRAP_LIBRARIES) + set(WRAP_INCLUDE_DIR) + set(WRAP_INCLUDE_DIRS) +endif() diff --git a/CMake/GenerateCMakeExports.cmake b/CMake/GenerateCMakeExports.cmake index e231e58727..a2abebe786 100644 --- a/CMake/GenerateCMakeExports.cmake +++ b/CMake/GenerateCMakeExports.cmake @@ -15,15 +15,15 @@ # DCMTKConfig.cmake will contain options used to build this DCMTK package # Get and store all executable targets to DCMTKTargets.cmake within build's main dir -GET_PROPERTY(DCMTK_EXECUTABLE_TARGETS GLOBAL PROPERTY DCMTK_EXECUTABLE_TARGETS) -EXPORT(TARGETS ${DCMTK_EXECUTABLE_TARGETS} APPEND FILE "${DCMTK_BUILD_CMKDIR}/DCMTKTargets.cmake") +get_property(DCMTK_EXECUTABLE_TARGETS GLOBAL PROPERTY DCMTK_EXECUTABLE_TARGETS) +export(TARGETS ${DCMTK_EXECUTABLE_TARGETS} APPEND FILE "${DCMTK_BUILD_CMKDIR}/DCMTKTargets.cmake") # Get and store libraries to DCMTKTargets.cmake within the build's main dir -GET_PROPERTY(DCMTK_LIBRARY_TARGETS GLOBAL PROPERTY DCMTK_LIBRARY_TARGETS) -EXPORT(TARGETS ${DCMTK_LIBRARY_TARGETS} APPEND FILE "${DCMTK_BUILD_CMKDIR}/DCMTKTargets.cmake") +get_property(DCMTK_LIBRARY_TARGETS GLOBAL PROPERTY DCMTK_LIBRARY_TARGETS) +export(TARGETS ${DCMTK_LIBRARY_TARGETS} APPEND FILE "${DCMTK_BUILD_CMKDIR}/DCMTKTargets.cmake") # Create DCMTConfigVersion.cmake with basic DCMTK version information (build tree) -SET(DCMTK_CONFIG_VERSION "${DCMTK_BUILD_CMKDIR}/DCMTKConfigVersion.cmake") +set(DCMTK_CONFIG_VERSION "${DCMTK_BUILD_CMKDIR}/DCMTKConfigVersion.cmake") WRITE_BASIC_PACKAGE_VERSION_FILE( ${DCMTK_CONFIG_VERSION} VERSION ${DCMTK_MAJOR_VERSION}.${DCMTK_MINOR_VERSION}.${DCMTK_BUILD_VERSION} @@ -36,21 +36,21 @@ WRITE_BASIC_PACKAGE_VERSION_FILE( # build and install tree versions of the file. # Case 1: Configure 'DCMTKConfig.cmake' for a build tree. -SET(DCMTK_CMKDIR_CONFIG "${DCMTK_BUILD_CMKDIR}") +set(DCMTK_CMKDIR_CONFIG "${DCMTK_BUILD_CMKDIR}") # Collect include paths -SET(DCMTK_INCLUDE_DIR_CONFIGS +set(DCMTK_INCLUDE_DIR_CONFIGS "SET_AND_CHECK(DCMTK_config_INCLUDE_DIR \"${DCMTK_BINARY_DIR}/config/include/dcmtk/config\")") -FOREACH(module ${DCMTK_MODULES}) - SET(DCMTK_INCLUDE_DIR_CONFIGS +foreach(module ${DCMTK_MODULES}) + set(DCMTK_INCLUDE_DIR_CONFIGS "${DCMTK_INCLUDE_DIR_CONFIGS}\nSET_AND_CHECK(DCMTK_${module}_INCLUDE_DIR \"${DCMTK_SOURCE_DIR}/${module}/include/dcmtk/${module}\")") -ENDFOREACH(module) -SET(DCMTK_CONFIG_CODE "####### Expanded from \@DCMTK_CONFIG_CODE\@ #######\n") -SET(DCMTK_CONFIG_CODE "${DCMTK_CONFIG_CODE}list(APPEND DCMTK_INCLUDE_DIRS \"${DCMTK_BINARY_DIR}/config/include\")\n") -FOREACH(module ${DCMTK_MODULES}) - SET(DCMTK_CONFIG_CODE "${DCMTK_CONFIG_CODE}list(APPEND DCMTK_INCLUDE_DIRS \"${DCMTK_SOURCE_DIR}/${module}/include\")\n") -ENDFOREACH(module) -SET(DCMTK_CONFIG_CODE "${DCMTK_CONFIG_CODE}##################################################") -SET(dcmtk_config "${DCMTK_BUILD_CMKDIR}/DCMTKConfig.cmake") +endforeach() +set(DCMTK_CONFIG_CODE "####### Expanded from \@DCMTK_CONFIG_CODE\@ #######\n") +set(DCMTK_CONFIG_CODE "${DCMTK_CONFIG_CODE}list(APPEND DCMTK_INCLUDE_DIRS \"${DCMTK_BINARY_DIR}/config/include\")\n") +foreach(module ${DCMTK_MODULES}) + set(DCMTK_CONFIG_CODE "${DCMTK_CONFIG_CODE}list(APPEND DCMTK_INCLUDE_DIRS \"${DCMTK_SOURCE_DIR}/${module}/include\")\n") +endforeach() +set(DCMTK_CONFIG_CODE "${DCMTK_CONFIG_CODE}##################################################") +set(dcmtk_config "${DCMTK_BUILD_CMKDIR}/DCMTKConfig.cmake") # Actually configure file and write it to build's main directory CONFIGURE_PACKAGE_CONFIG_FILE( CMake/DCMTKConfig.cmake.in @@ -60,18 +60,18 @@ CONFIGURE_PACKAGE_CONFIG_FILE( NO_CHECK_REQUIRED_COMPONENTS_MACRO) # Case 2: Configure 'DCMTKConfig.cmake' for an install tree -SET(DCMTK_CMKDIR_CONFIG "${DCMTK_INSTALL_CMKDIR}") +set(DCMTK_CMKDIR_CONFIG "${DCMTK_INSTALL_CMKDIR}") # Collect include paths -SET(DCMTK_INCLUDE_DIR_CONFIGS +set(DCMTK_INCLUDE_DIR_CONFIGS "SET_AND_CHECK(DCMTK_config_INCLUDE_DIR \"\${PACKAGE_PREFIX_DIR}/include/dcmtk/config\")") -FOREACH(module ${DCMTK_MODULES}) - SET(DCMTK_INCLUDE_DIR_CONFIGS +foreach(module ${DCMTK_MODULES}) + set(DCMTK_INCLUDE_DIR_CONFIGS "${DCMTK_INCLUDE_DIR_CONFIGS}\nSET_AND_CHECK(DCMTK_${module}_INCLUDE_DIR \"\${PACKAGE_PREFIX_DIR}/include/dcmtk/${module}\")") -ENDFOREACH(module) -SET(DCMTK_CONFIG_CODE "####### Expanded from \@DCMTK_CONFIG_CODE\@ #######\n") -SET(DCMTK_CONFIG_CODE "${DCMTK_CONFIG_CODE}list(APPEND DCMTK_INCLUDE_DIRS \"\${PACKAGE_PREFIX_DIR}/include\")\n") -SET(DCMTK_CONFIG_CODE "${DCMTK_CONFIG_CODE}##################################################") -SET(DCMTK_INSTALL_CONFIG "${CMAKE_BINARY_DIR}/CMakeFiles/DCMTKConfig.cmake") +endforeach() +set(DCMTK_CONFIG_CODE "####### Expanded from \@DCMTK_CONFIG_CODE\@ #######\n") +set(DCMTK_CONFIG_CODE "${DCMTK_CONFIG_CODE}list(APPEND DCMTK_INCLUDE_DIRS \"\${PACKAGE_PREFIX_DIR}/include\")\n") +set(DCMTK_CONFIG_CODE "${DCMTK_CONFIG_CODE}##################################################") +set(DCMTK_INSTALL_CONFIG "${CMAKE_BINARY_DIR}/CMakeFiles/DCMTKConfig.cmake") # Actually configure file and set rule to install it to installation subdir CONFIGURE_PACKAGE_CONFIG_FILE( CMake/DCMTKConfig.cmake.in diff --git a/CMake/GenerateDCMTKConfigure.cmake b/CMake/GenerateDCMTKConfigure.cmake index 2d159723a8..949ac485bb 100644 --- a/CMake/GenerateDCMTKConfigure.cmake +++ b/CMake/GenerateDCMTKConfigure.cmake @@ -1,175 +1,175 @@ # Set build configuration to use for configuration tests -IF(CMAKE_BUILD_TYPE) - SET(CMAKE_TRY_COMPILE_CONFIGURATION "${CMAKE_BUILD_TYPE}") -ELSE(CMAKE_BUILD_TYPE) - SET(CMAKE_TRY_COMPILE_CONFIGURATION "Release") -ENDIF(CMAKE_BUILD_TYPE) +if(CMAKE_BUILD_TYPE) + set(CMAKE_TRY_COMPILE_CONFIGURATION "${CMAKE_BUILD_TYPE}") +else() + set(CMAKE_TRY_COMPILE_CONFIGURATION "Release") +endif() # Compiled-in dictionary support -IF(DCMTK_ENABLE_BUILTIN_DICTIONARY) - SET(ENABLE_BUILTIN_DICTIONARY 1) - MESSAGE(STATUS "Info: DCMTK will compile with built-in (compiled-in) dictionary") +if(DCMTK_ENABLE_BUILTIN_DICTIONARY) + set(ENABLE_BUILTIN_DICTIONARY 1) + message(STATUS "Info: DCMTK will compile with built-in (compiled-in) dictionary") # No extra variable needed since its only evaluated in CMake files -ELSE(DCMTK_ENABLE_BUILTIN_DICTIONARY) - SET(ENABLE_BUILTIN_DICTIONARY "") - MESSAGE(STATUS "Info: DCMTK will compile without built-in (compiled-in) dictionary") +else() + set(ENABLE_BUILTIN_DICTIONARY "") + message(STATUS "Info: DCMTK will compile without built-in (compiled-in) dictionary") # No extra variable needed since its only evaluated in CMake files -ENDIF(DCMTK_ENABLE_BUILTIN_DICTIONARY) +endif() # External dictionary support -IF(DCMTK_ENABLE_EXTERNAL_DICTIONARY) - SET(ENABLE_EXTERNAL_DICTIONARY 1) - MESSAGE(STATUS "Info: DCMTK will try to load external dictionary from default path on startup") -ELSE(DCMTK_ENABLE_EXTERNAL_DICTIONARY) - SET(ENABLE_EXTERNAL_DICTIONARY "") - MESSAGE(STATUS "Info: DCMTK will not try to load external dictionary from default path on startup") -ENDIF(DCMTK_ENABLE_EXTERNAL_DICTIONARY) +if(DCMTK_ENABLE_EXTERNAL_DICTIONARY) + set(ENABLE_EXTERNAL_DICTIONARY 1) + message(STATUS "Info: DCMTK will try to load external dictionary from default path on startup") +else() + set(ENABLE_EXTERNAL_DICTIONARY "") + message(STATUS "Info: DCMTK will not try to load external dictionary from default path on startup") +endif() # Private tags -IF(DCMTK_ENABLE_PRIVATE_TAGS) - SET(ENABLE_PRIVATE_TAGS 1) - MESSAGE(STATUS "Info: DCMTK's builtin private dictionary support will be enabled") -ELSE(DCMTK_ENABLE_PRIVATE_TAGS) - SET(ENABLE_PRIVATE_TAGS "") - MESSAGE(STATUS "Info: DCMTK's builtin private dictionary support will be disabled") -ENDIF(DCMTK_ENABLE_PRIVATE_TAGS) +if(DCMTK_ENABLE_PRIVATE_TAGS) + set(ENABLE_PRIVATE_TAGS 1) + message(STATUS "Info: DCMTK's builtin private dictionary support will be enabled") +else() + set(ENABLE_PRIVATE_TAGS "") + message(STATUS "Info: DCMTK's builtin private dictionary support will be disabled") +endif() # Thread support -IF(DCMTK_WITH_THREADS) - SET(WITH_THREADS 1) - MESSAGE(STATUS "Info: Thread support will be enabled") -ELSE(DCMTK_WITH_THREADS) - SET(WITH_THREADS "") - MESSAGE(STATUS "Info: Thread support will be disabled") -ENDIF(DCMTK_WITH_THREADS) +if(DCMTK_WITH_THREADS) + set(WITH_THREADS 1) + message(STATUS "Info: Thread support will be enabled") +else() + set(WITH_THREADS "") + message(STATUS "Info: Thread support will be disabled") +endif() # Wide char file I/O support -IF(DCMTK_WIDE_CHAR_FILE_IO_FUNCTIONS) - SET(WIDE_CHAR_FILE_IO_FUNCTIONS 1) - MESSAGE(STATUS "Info: Wide char file I/O functions will be enabled") -ELSE(DCMTK_WIDE_CHAR_FILE_IO_FUNCTIONS) - SET(WIDE_CHAR_FILE_IO_FUNCTIONS "") - MESSAGE(STATUS "Info: Wide char file I/O functions will be disabled") -ENDIF(DCMTK_WIDE_CHAR_FILE_IO_FUNCTIONS) +if(DCMTK_WIDE_CHAR_FILE_IO_FUNCTIONS) + set(WIDE_CHAR_FILE_IO_FUNCTIONS 1) + message(STATUS "Info: Wide char file I/O functions will be enabled") +else() + set(WIDE_CHAR_FILE_IO_FUNCTIONS "") + message(STATUS "Info: Wide char file I/O functions will be disabled") +endif() # Wide char main function -IF(DCMTK_WIDE_CHAR_MAIN_FUNCTION) - SET(WIDE_CHAR_MAIN_FUNCTION 1) - MESSAGE(STATUS "Info: Wide char main function for command line tools will be enabled") -ELSE(DCMTK_WIDE_CHAR_MAIN_FUNCTION) - SET(WIDE_CHAR_MAIN_FUNCTION "") - MESSAGE(STATUS "Info: Wide char main function for command line tools will be disabled") -ENDIF(DCMTK_WIDE_CHAR_MAIN_FUNCTION) - -IF(NOT DCMTK_ENABLE_CHARSET_CONVERSION) - SET(DCMTK_ENABLE_CHARSET_CONVERSION_DOCSTRING "Select character set conversion implementation.") - IF(DCMTK_WITH_ICONV) - IF(DCMTK_WITH_ICU) - MESSAGE(WARNING "Warning: Both ICU and the libiconv are available, using libiconv. Modify DCMTK_ENABLE_CHARSET_CONVERSION for switching to ICU") - ENDIF() - SET(DCMTK_ENABLE_CHARSET_CONVERSION "libiconv" CACHE STRING "${DCMTK_ENABLE_CHARSET_CONVERSION_DOCSTRING}") - ELSEIF(DCMTK_WITH_ICU) - SET(DCMTK_ENABLE_CHARSET_CONVERSION "ICU" CACHE STRING "${DCMTK_ENABLE_CHARSET_CONVERSION_DOCSTRING}") - ELSEIF(DCMTK_WITH_STDLIBC_ICONV) - SET(DCMTK_ENABLE_CHARSET_CONVERSION "stdlibc (iconv)" CACHE STRING "${DCMTK_ENABLE_CHARSET_CONVERSION_DOCSTRING}") - ELSE() - SET(DCMTK_ENABLE_CHARSET_CONVERSION "" CACHE STRING "${DCMTK_ENABLE_CHARSET_CONVERSION_DOCSTRING}") - ENDIF() -ENDIF() - -SET(DCMTK_ENABLE_CHARSET_CONVERSION_ALTERNATIVES) -IF(DCMTK_WITH_ICONV) - LIST(APPEND DCMTK_ENABLE_CHARSET_CONVERSION_ALTERNATIVES "libiconv") -ENDIF() -IF(DCMTK_WITH_ICU) - LIST(APPEND DCMTK_ENABLE_CHARSET_CONVERSION_ALTERNATIVES "ICU") -ENDIF() -IF(DCMTK_WITH_STDLIBC_ICONV) - LIST(APPEND DCMTK_ENABLE_CHARSET_CONVERSION_ALTERNATIVES "stdlibc (iconv)") -ENDIF() -SET_PROPERTY(CACHE DCMTK_ENABLE_CHARSET_CONVERSION PROPERTY STRINGS ${DCMTK_ENABLE_CHARSET_CONVERSION_ALTERNATIVES} "") - -IF(DCMTK_ENABLE_CHARSET_CONVERSION STREQUAL "libiconv" OR DCMTK_ENABLE_CHARSET_CONVERSION STREQUAL "DCMTK_CHARSET_CONVERSION_ICONV") - MESSAGE(STATUS "Info: Building DCMTK with character set conversion support using libiconv") - SET(DCMTK_ENABLE_CHARSET_CONVERSION "DCMTK_CHARSET_CONVERSION_ICONV") - SET(CHARSET_CONVERSION_LIBS ${LIBICONV_LIBS}) -ELSEIF(DCMTK_ENABLE_CHARSET_CONVERSION STREQUAL "ICU" OR DCMTK_ENABLE_CHARSET_CONVERSION STREQUAL "DCMTK_CHARSET_CONVERSION_ICU") - MESSAGE(STATUS "Info: Building DCMTK with character set conversion support using the ICU") - SET(DCMTK_ENABLE_CHARSET_CONVERSION "DCMTK_CHARSET_CONVERSION_ICU") - SET(CHARSET_CONVERSION_LIBS ${ICU_LIBS}) -ELSEIF(DCMTK_ENABLE_CHARSET_CONVERSION STREQUAL "stdlibc (iconv)" OR DCMTK_ENABLE_CHARSET_CONVERSION STREQUAL "DCMTK_CHARSET_CONVERSION_STDLIBC_ICONV") - MESSAGE(STATUS "Info: Building DCMTK with character set conversion support using builtin iconv functions from the C standard library") - SET(DCMTK_ENABLE_CHARSET_CONVERSION "DCMTK_CHARSET_CONVERSION_STDLIBC_ICONV") -ELSE() - MESSAGE(STATUS "Info: Building DCMTK without character set conversion support") - SET(DCMTK_ENABLE_CHARSET_CONVERSION OFF) -ENDIF() +if(DCMTK_WIDE_CHAR_MAIN_FUNCTION) + set(WIDE_CHAR_MAIN_FUNCTION 1) + message(STATUS "Info: Wide char main function for command line tools will be enabled") +else() + set(WIDE_CHAR_MAIN_FUNCTION "") + message(STATUS "Info: Wide char main function for command line tools will be disabled") +endif() + +if(NOT DCMTK_ENABLE_CHARSET_CONVERSION) + set(DCMTK_ENABLE_CHARSET_CONVERSION_DOCSTRING "Select character set conversion implementation.") + if(DCMTK_WITH_ICONV) + if(DCMTK_WITH_ICU) + message(WARNING "Warning: Both ICU and the libiconv are available, using libiconv. Modify DCMTK_ENABLE_CHARSET_CONVERSION for switching to ICU") + endif() + set(DCMTK_ENABLE_CHARSET_CONVERSION "libiconv" CACHE STRING "${DCMTK_ENABLE_CHARSET_CONVERSION_DOCSTRING}") + elseif(DCMTK_WITH_ICU) + set(DCMTK_ENABLE_CHARSET_CONVERSION "ICU" CACHE STRING "${DCMTK_ENABLE_CHARSET_CONVERSION_DOCSTRING}") + elseif(DCMTK_WITH_STDLIBC_ICONV) + set(DCMTK_ENABLE_CHARSET_CONVERSION "stdlibc (iconv)" CACHE STRING "${DCMTK_ENABLE_CHARSET_CONVERSION_DOCSTRING}") + else() + set(DCMTK_ENABLE_CHARSET_CONVERSION "" CACHE STRING "${DCMTK_ENABLE_CHARSET_CONVERSION_DOCSTRING}") + endif() +endif() + +set(DCMTK_ENABLE_CHARSET_CONVERSION_ALTERNATIVES) +if(DCMTK_WITH_ICONV) + list(APPEND DCMTK_ENABLE_CHARSET_CONVERSION_ALTERNATIVES "libiconv") +endif() +if(DCMTK_WITH_ICU) + list(APPEND DCMTK_ENABLE_CHARSET_CONVERSION_ALTERNATIVES "ICU") +endif() +if(DCMTK_WITH_STDLIBC_ICONV) + list(APPEND DCMTK_ENABLE_CHARSET_CONVERSION_ALTERNATIVES "stdlibc (iconv)") +endif() +set_property(CACHE DCMTK_ENABLE_CHARSET_CONVERSION PROPERTY STRINGS ${DCMTK_ENABLE_CHARSET_CONVERSION_ALTERNATIVES} "") + +if(DCMTK_ENABLE_CHARSET_CONVERSION STREQUAL "libiconv" OR DCMTK_ENABLE_CHARSET_CONVERSION STREQUAL "DCMTK_CHARSET_CONVERSION_ICONV") + message(STATUS "Info: Building DCMTK with character set conversion support using libiconv") + set(DCMTK_ENABLE_CHARSET_CONVERSION "DCMTK_CHARSET_CONVERSION_ICONV") + set(CHARSET_CONVERSION_LIBS ${LIBICONV_LIBS}) +elseif(DCMTK_ENABLE_CHARSET_CONVERSION STREQUAL "ICU" OR DCMTK_ENABLE_CHARSET_CONVERSION STREQUAL "DCMTK_CHARSET_CONVERSION_ICU") + message(STATUS "Info: Building DCMTK with character set conversion support using the ICU") + set(DCMTK_ENABLE_CHARSET_CONVERSION "DCMTK_CHARSET_CONVERSION_ICU") + set(CHARSET_CONVERSION_LIBS ${ICU_LIBS}) +elseif(DCMTK_ENABLE_CHARSET_CONVERSION STREQUAL "stdlibc (iconv)" OR DCMTK_ENABLE_CHARSET_CONVERSION STREQUAL "DCMTK_CHARSET_CONVERSION_STDLIBC_ICONV") + message(STATUS "Info: Building DCMTK with character set conversion support using builtin iconv functions from the C standard library") + set(DCMTK_ENABLE_CHARSET_CONVERSION "DCMTK_CHARSET_CONVERSION_STDLIBC_ICONV") +else() + message(STATUS "Info: Building DCMTK without character set conversion support") + set(DCMTK_ENABLE_CHARSET_CONVERSION OFF) +endif() # Standard C++ headers (currently hard-coded) -#IF(VTK_USE_ANSI_STDLIB) - SET(USE_STD_CXX_INCLUDES 1) -#ELSE(VTK_USE_ANSI_STDLIB) -# SET(USE_STD_CXX_INCLUDES "") -#ENDIF(VTK_USE_ANSI_STDLIB) +#if(VTK_USE_ANSI_STDLIB) + set(USE_STD_CXX_INCLUDES 1) +#else() +# set(USE_STD_CXX_INCLUDES "") +#endif() # Configure file # Windows being windows, it lies about its processor type to 32 bit binaries -SET(SYSTEM_PROCESSOR "$ENV{PROCESSOR_ARCHITEW6432}") -IF(NOT SYSTEM_PROCESSOR) - SET(SYSTEM_PROCESSOR "${CMAKE_SYSTEM_PROCESSOR}") -ENDIF(NOT SYSTEM_PROCESSOR) +set(SYSTEM_PROCESSOR "$ENV{PROCESSOR_ARCHITEW6432}") +if(NOT SYSTEM_PROCESSOR) + set(SYSTEM_PROCESSOR "${CMAKE_SYSTEM_PROCESSOR}") +endif() # CMake doesn't provide a configure-style system type string -SET(CANONICAL_HOST_TYPE "${SYSTEM_PROCESSOR}-${CMAKE_SYSTEM_NAME}") +set(CANONICAL_HOST_TYPE "${SYSTEM_PROCESSOR}-${CMAKE_SYSTEM_NAME}") DCMTK_UNSET(SYSTEM_PROCESSOR) # Configure dictionary path and install prefix -IF(WIN32 AND NOT CYGWIN) +if(WIN32 AND NOT CYGWIN) # Set DCMTK_PREFIX needed within some code. Be sure that all / are replaced by \\. - SET(DCMTK_PREFIX "${CMAKE_INSTALL_PREFIX}") - STRING(REGEX REPLACE "/" "\\\\\\\\" DCMTK_PREFIX "${DCMTK_PREFIX}") + set(DCMTK_PREFIX "${CMAKE_INSTALL_PREFIX}") + string(REGEX REPLACE "/" "\\\\\\\\" DCMTK_PREFIX "${DCMTK_PREFIX}") # Set path and multiple path separator being used in dictionary code etc. - SET(PATH_SEPARATOR "\\\\") - SET(ENVIRONMENT_PATH_SEPARATOR ";") + set(PATH_SEPARATOR "\\\\") + set(ENVIRONMENT_PATH_SEPARATOR ";") # Set dictionary path to the data dir inside install main dir (prefix) - IF(DCMTK_ENABLE_EXTERNAL_DICTIONARY) - SET(DCM_DICT_DEFAULT_PATH "${DCMTK_PREFIX}\\\\${CMAKE_INSTALL_DATADIR}\\\\dcmtk\\\\dicom.dic") + if(DCMTK_ENABLE_EXTERNAL_DICTIONARY) + set(DCM_DICT_DEFAULT_PATH "${DCMTK_PREFIX}\\\\${CMAKE_INSTALL_DATADIR}\\\\dcmtk\\\\dicom.dic") # If private dictionary should be utilized, add it to default dictionary path. - IF(ENABLE_PRIVATE_TAGS) - SET(DCM_DICT_DEFAULT_PATH "${DCM_DICT_DEFAULT_PATH};${DCMTK_PREFIX}\\\\${CMAKE_INSTALL_DATADIR}\\\\dcmtk\\\\private.dic") - ENDIF(ENABLE_PRIVATE_TAGS) + if(ENABLE_PRIVATE_TAGS) + set(DCM_DICT_DEFAULT_PATH "${DCM_DICT_DEFAULT_PATH};${DCMTK_PREFIX}\\\\${CMAKE_INSTALL_DATADIR}\\\\dcmtk\\\\private.dic") + endif() # Again, for Windows strip all / from path and replace it with \\. - STRING(REGEX REPLACE "/" "\\\\\\\\" DCM_DICT_DEFAULT_PATH "${DCM_DICT_DEFAULT_PATH}") - ELSE(DCMTK_ENABLE_EXTERNAL_DICTIONARY) - SET(DCM_DICT_DEFAULT_PATH "") - ENDIF(DCMTK_ENABLE_EXTERNAL_DICTIONARY) + string(REGEX REPLACE "/" "\\\\\\\\" DCM_DICT_DEFAULT_PATH "${DCM_DICT_DEFAULT_PATH}") + else() + set(DCM_DICT_DEFAULT_PATH "") + endif() # Set default directory for configuration and support data. - SET(DCMTK_DEFAULT_CONFIGURATION_DIR "") - SET(DCMTK_DEFAULT_SUPPORT_DATA_DIR "") -ELSE(WIN32 AND NOT CYGWIN) + set(DCMTK_DEFAULT_CONFIGURATION_DIR "") + set(DCMTK_DEFAULT_SUPPORT_DATA_DIR "") +else() # Set DCMTK_PREFIX needed within some code. - SET(DCMTK_PREFIX "${CMAKE_INSTALL_PREFIX}") + set(DCMTK_PREFIX "${CMAKE_INSTALL_PREFIX}") # Set path and multiple path separator being used in dictionary code etc. - SET(PATH_SEPARATOR "/") - SET(ENVIRONMENT_PATH_SEPARATOR ":") + set(PATH_SEPARATOR "/") + set(ENVIRONMENT_PATH_SEPARATOR ":") # Set dictionary path to the data dir inside install main dir (prefix). - IF(DCMTK_ENABLE_EXTERNAL_DICTIONARY) - SET(DCM_DICT_DEFAULT_PATH "${DCMTK_PREFIX}/${CMAKE_INSTALL_DATADIR}/dcmtk/dicom.dic") + if(DCMTK_ENABLE_EXTERNAL_DICTIONARY) + set(DCM_DICT_DEFAULT_PATH "${DCMTK_PREFIX}/${CMAKE_INSTALL_DATADIR}/dcmtk/dicom.dic") # If private dictionary should be utilized, add it to default dictionary path. - IF(ENABLE_PRIVATE_TAGS) - SET(DCM_DICT_DEFAULT_PATH "${DCM_DICT_DEFAULT_PATH}:${DCMTK_PREFIX}/${CMAKE_INSTALL_DATADIR}/dcmtk/private.dic") - ENDIF(ENABLE_PRIVATE_TAGS) - ELSE(DCMTK_ENABLE_EXTERNAL_DICTIONARY) - SET(DCM_DICT_DEFAULT_PATH "") - ENDIF(DCMTK_ENABLE_EXTERNAL_DICTIONARY) + if(ENABLE_PRIVATE_TAGS) + set(DCM_DICT_DEFAULT_PATH "${DCM_DICT_DEFAULT_PATH}:${DCMTK_PREFIX}/${CMAKE_INSTALL_DATADIR}/dcmtk/private.dic") + endif() + else() + set(DCM_DICT_DEFAULT_PATH "") + endif() # Set default directory for configuration and support data. - SET(DCMTK_DEFAULT_CONFIGURATION_DIR "${DCMTK_PREFIX}/${CMAKE_INSTALL_SYSCONFDIR}/dcmtk/") - SET(DCMTK_DEFAULT_SUPPORT_DATA_DIR "${DCMTK_PREFIX}/${CMAKE_INSTALL_DATADIR}/dcmtk/") -ENDIF(WIN32 AND NOT CYGWIN) + set(DCMTK_DEFAULT_CONFIGURATION_DIR "${DCMTK_PREFIX}/${CMAKE_INSTALL_SYSCONFDIR}/dcmtk/") + set(DCMTK_DEFAULT_SUPPORT_DATA_DIR "${DCMTK_PREFIX}/${CMAKE_INSTALL_DATADIR}/dcmtk/") +endif() # Check the sizes of various types -INCLUDE (CheckTypeSize) +include (CheckTypeSize) CHECK_TYPE_SIZE("char" SIZEOF_CHAR) CHECK_TYPE_SIZE("double" SIZEOF_DOUBLE) CHECK_TYPE_SIZE("float" SIZEOF_FLOAT) @@ -179,69 +179,69 @@ CHECK_TYPE_SIZE("short" SIZEOF_SHORT) CHECK_TYPE_SIZE("void*" SIZEOF_VOID_P) # Check for include files, libraries, and functions -INCLUDE("${DCMTK_CMAKE_INCLUDE}CMake/dcmtkTryCompile.cmake") -INCLUDE("${DCMTK_CMAKE_INCLUDE}CMake/dcmtkTryRun.cmake") -INCLUDE("${CMAKE_ROOT}/Modules/CheckIncludeFileCXX.cmake") -INCLUDE("${CMAKE_ROOT}/Modules/CheckIncludeFiles.cmake") -INCLUDE("${CMAKE_ROOT}/Modules/CheckSymbolExists.cmake") -INCLUDE("${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake") -INCLUDE("${CMAKE_ROOT}/Modules/CheckLibraryExists.cmake") -INCLUDE("${DCMTK_CMAKE_INCLUDE}CMake/CheckFunctionWithHeaderExists.cmake") -INCLUDE(CheckCXXSymbolExists OPTIONAL) -IF(NOT COMMAND CHECK_CXX_SYMBOL_EXISTS) +include("${DCMTK_CMAKE_INCLUDE}CMake/dcmtkTryCompile.cmake") +include("${DCMTK_CMAKE_INCLUDE}CMake/dcmtkTryRun.cmake") +include("${CMAKE_ROOT}/Modules/CheckIncludeFileCXX.cmake") +include("${CMAKE_ROOT}/Modules/CheckIncludeFiles.cmake") +include("${CMAKE_ROOT}/Modules/CheckSymbolExists.cmake") +include("${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake") +include("${CMAKE_ROOT}/Modules/CheckLibraryExists.cmake") +include("${DCMTK_CMAKE_INCLUDE}CMake/CheckFunctionWithHeaderExists.cmake") +include(CheckCXXSymbolExists OPTIONAL) +if(NOT COMMAND CHECK_CXX_SYMBOL_EXISTS) # fallback implementation for old CMake Versions - FUNCTION(CHECK_CXX_SYMBOL_EXISTS SYMBOL FILES VAR) - SET(CODE) - FOREACH(FILE ${FILES}) - SET(CODE "${CODE}#include <${FILE}>\n") - ENDFOREACH() - SET(CODE "${CODE}\nint main(int argc, char** argv)\n{\n (void)argv;\n#ifndef ${SYMBOL}\n return ((int*)(&${SYMBOL}))[argc];\n#else\n (void)argc;\n return 0;\n#endif\n}\n") + function(CHECK_CXX_SYMBOL_EXISTS SYMBOL FILES VAR) + set(CODE) + foreach(FILE ${FILES}) + set(CODE "${CODE}#include <${FILE}>\n") + endforeach() + set(CODE "${CODE}\nint main(int argc, char** argv)\n{\n (void)argv;\n#ifndef ${SYMBOL}\n return ((int*)(&${SYMBOL}))[argc];\n#else\n (void)argc;\n return 0;\n#endif\n}\n") DCMTK_TRY_COMPILE("${VAR}" "the compiler supports ${SYMBOL}" "${CODE}") - ENDFUNCTION() -ENDIF(NOT COMMAND CHECK_CXX_SYMBOL_EXISTS) + endfunction() +endif() -FOREACH(FUNC "__FUNCTION__" "__PRETTY_FUNCTION__" "__func__") +foreach(FUNC "__FUNCTION__" "__PRETTY_FUNCTION__" "__func__") CHECK_SYMBOL_EXISTS("${FUNC}" "" "HAVE_${FUNC}_C_MACRO") # test if the C++ compiler also supports them (e.g. SunPro doesn't) CHECK_CXX_SYMBOL_EXISTS("${FUNC}" "" "HAVE_${FUNC}_CXX_MACRO") - IF(HAVE_${FUNC}_C_MACRO AND HAVE_${FUNC}_CXX_MACRO) - SET("HAVE_${FUNC}_MACRO" 1 CACHE INTERNAL "Have symbol ${FUNC}" FORCE) - ELSE() - SET("HAVE_${FUNC}_MACRO" CACHE INTERNAL "Have symbol ${FUNC}" FORCE) - ENDIF() -ENDFOREACH() + if(HAVE_${FUNC}_C_MACRO AND HAVE_${FUNC}_CXX_MACRO) + set("HAVE_${FUNC}_MACRO" 1 CACHE INTERNAL "Have symbol ${FUNC}" FORCE) + else() + set("HAVE_${FUNC}_MACRO" CACHE INTERNAL "Have symbol ${FUNC}" FORCE) + endif() +endforeach() # prepare include directories for 3rdparty libraries before performing # header searches -IF(ZLIB_INCDIR) - LIST(APPEND CMAKE_REQUIRED_INCLUDES "${ZLIB_INCDIR}") -ENDIF(ZLIB_INCDIR) +if(ZLIB_INCDIR) + list(APPEND CMAKE_REQUIRED_INCLUDES "${ZLIB_INCDIR}") +endif() -IF(ZLIB_INCLUDE_DIRS) - LIST(APPEND CMAKE_REQUIRED_INCLUDES "${ZLIB_INCLUDE_DIRS}") -ENDIF(ZLIB_INCLUDE_DIRS) +if(ZLIB_INCLUDE_DIRS) + list(APPEND CMAKE_REQUIRED_INCLUDES "${ZLIB_INCLUDE_DIRS}") +endif() -IF(LIBPNG_INCDIR) - LIST(APPEND CMAKE_REQUIRED_INCLUDES "${LIBPNG_INCDIR}") -ENDIF(LIBPNG_INCDIR) +if(LIBPNG_INCDIR) + list(APPEND CMAKE_REQUIRED_INCLUDES "${LIBPNG_INCDIR}") +endif() -IF(PNG_INCLUDE_DIR) - LIST(APPEND CMAKE_REQUIRED_INCLUDES "${PNG_INCLUDE_DIR}") -ENDIF(PNG_INCLUDE_DIR) +if(PNG_INCLUDE_DIR) + list(APPEND CMAKE_REQUIRED_INCLUDES "${PNG_INCLUDE_DIR}") +endif() -IF(OPENSSL_INCDIR) - LIST(APPEND CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCDIR}") -ENDIF(OPENSSL_INCDIR) +if(OPENSSL_INCDIR) + list(APPEND CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCDIR}") +endif() -IF(OPENSSL_INCLUDE_DIR) - LIST(APPEND CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCLUDE_DIR}") -ENDIF(OPENSSL_INCLUDE_DIR) +if(OPENSSL_INCLUDE_DIR) + list(APPEND CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCLUDE_DIR}") +endif() # For Windows, hardcode these values to avoid long search times -IF(WIN32 AND NOT CYGWIN) +if(WIN32 AND NOT CYGWIN) CHECK_INCLUDE_FILE_CXX("windows.h" HAVE_WINDOWS_H) CHECK_INCLUDE_FILE_CXX("winsock.h" HAVE_WINSOCK_H) -ENDIF(WIN32 AND NOT CYGWIN) +endif() CHECK_INCLUDE_FILE_CXX("errno.h" HAVE_ERRNO_H) CHECK_INCLUDE_FILE_CXX("dirent.h" HAVE_DIRENT_H) @@ -325,52 +325,52 @@ ENDIF(WIN32 AND NOT CYGWIN) CHECK_INCLUDE_FILE_CXX("signal.h" HAVE_SIGNAL_H) CHECK_INCLUDE_FILE_CXX("fenv.h" HAVE_FENV_H) -IF(NOT APPLE) +if(NOT APPLE) # poll on macOS is unreliable, it first did not exist, then was broken until # fixed in 10.9 only to break again in 10.12. CHECK_INCLUDE_FILE_CXX("poll.h" DCMTK_HAVE_POLL) - IF(DCMTK_HAVE_POLL) - ADD_DEFINITIONS(-DDCMTK_HAVE_POLL=1) - ENDIF(DCMTK_HAVE_POLL) -ENDIF() + if(DCMTK_HAVE_POLL) + add_definitions(-DDCMTK_HAVE_POLL=1) + endif() +endif() # This mimics the autoconf test. There are systems out there # (e.g. FreeBSD and NeXT) where tcp.h can't be compiled on its own. - SET(TCP_H_DEPS "") - IF(HAVE_SYS_TYPES_H) + set(TCP_H_DEPS "") + if(HAVE_SYS_TYPES_H) # This one is needed to make FreeBSD happy - SET(TCP_H_DEPS "sys/types.h") - ENDIF(HAVE_SYS_TYPES_H) + set(TCP_H_DEPS "sys/types.h") + endif() CHECK_INCLUDE_FILES("${TCP_H_DEPS};netinet/in_systm.h" HAVE_NETINET_IN_SYSTM_H) - IF(HAVE_NETINET_IN_SYSTM_H) - SET(TCP_H_DEPS "${TCP_H_DEPS};netinet/in_systm.h") - ENDIF(HAVE_NETINET_IN_SYSTM_H) + if(HAVE_NETINET_IN_SYSTM_H) + set(TCP_H_DEPS "${TCP_H_DEPS};netinet/in_systm.h") + endif() CHECK_INCLUDE_FILES("${TCP_H_DEPS};netinet/in.h" HAVE_NETINET_IN_H) - IF(HAVE_NETINET_IN_H) - SET(TCP_H_DEPS "${TCP_H_DEPS};netinet/in.h") - ENDIF(HAVE_NETINET_IN_H) + if(HAVE_NETINET_IN_H) + set(TCP_H_DEPS "${TCP_H_DEPS};netinet/in.h") + endif() CHECK_INCLUDE_FILES("${TCP_H_DEPS};netinet/tcp.h" HAVE_NETINET_TCP_H) - IF(NOT HAVE_PNG_H) + if(NOT HAVE_PNG_H) # is unavailable, so test if we need to include it as CHECK_INCLUDE_FILE_CXX("libpng/png.h" HAVE_LIBPNG_PNG_H) - ELSE(NOT HAVE_PNG_H) + else() # ensure including is preferred DCMTK_UNSET_CACHE(HAVE_LIBPNG_PNG_H) - ENDIF(NOT HAVE_PNG_H) + endif() # There is no CMake macro to take care of these yet - IF(WIN32 AND NOT CYGWIN AND NOT MINGW) - SET(HAVE_NO_TYPEDEF_SSIZE_T TRUE) - SET(HAVE_NO_TYPEDEF_PID_T TRUE) - ELSE(WIN32 AND NOT CYGWIN AND NOT MINGW) - SET(HAVE_NO_TYPEDEF_PID_T FALSE) - SET(HAVE_NO_TYPEDEF_SIZE_T FALSE) - IF(NOT ${HAVE_SYS_TYPES_H}) - SET(HAVE_NO_TYPEDEF_SSIZE_T TRUE) - ENDIF(NOT ${HAVE_SYS_TYPES_H}) - ENDIF(WIN32 AND NOT CYGWIN AND NOT MINGW) + if(WIN32 AND NOT CYGWIN AND NOT MINGW) + set(HAVE_NO_TYPEDEF_SSIZE_T TRUE) + set(HAVE_NO_TYPEDEF_PID_T TRUE) + else() + set(HAVE_NO_TYPEDEF_PID_T FALSE) + set(HAVE_NO_TYPEDEF_SIZE_T FALSE) + if(NOT ${HAVE_SYS_TYPES_H}) + set(HAVE_NO_TYPEDEF_SSIZE_T TRUE) + endif() + endif() CHECK_FUNCTION_EXISTS(connect HAVE_CONNECT) CHECK_FUNCTION_EXISTS(accept HAVE_ACCEPT) @@ -441,144 +441,144 @@ ENDIF() CHECK_FUNCTION_EXISTS(_findfirst HAVE__FINDFIRST) CHECK_FUNCTION_EXISTS(nanosleep HAVE_NANOSLEEP) - SET(HEADERS) + set(HEADERS) - IF(HAVE_IO_H) - SET(HEADERS ${HEADERS} io.h) - ENDIF(HAVE_IO_H) + if(HAVE_IO_H) + set(HEADERS ${HEADERS} io.h) + endif() - IF(HAVE_IOSTREAM_H) - SET(HEADERS ${HEADERS} iostream.h) - ENDIF(HAVE_IOSTREAM_H) + if(HAVE_IOSTREAM_H) + set(HEADERS ${HEADERS} iostream.h) + endif() - IF(HAVE_MATH_H) - SET(HEADERS ${HEADERS} math.h) - ENDIF(HAVE_MATH_H) + if(HAVE_MATH_H) + set(HEADERS ${HEADERS} math.h) + endif() - IF(HAVE_CMATH) - SET(HEADERS ${HEADERS} cmath) - ENDIF(HAVE_CMATH) + if(HAVE_CMATH) + set(HEADERS ${HEADERS} cmath) + endif() - IF(HAVE_LIBC_H) - SET(HEADERS ${HEADERS} libc.h) - ENDIF(HAVE_LIBC_H) + if(HAVE_LIBC_H) + set(HEADERS ${HEADERS} libc.h) + endif() - IF(HAVE_PTHREAD_H) - SET(HEADERS ${HEADERS} pthread.h) - ENDIF(HAVE_PTHREAD_H) + if(HAVE_PTHREAD_H) + set(HEADERS ${HEADERS} pthread.h) + endif() - IF(HAVE_UNISTD_H) - SET(HEADERS ${HEADERS} unistd.h) - ENDIF(HAVE_UNISTD_H) + if(HAVE_UNISTD_H) + set(HEADERS ${HEADERS} unistd.h) + endif() - IF(HAVE_STDLIB_H) - SET(HEADERS ${HEADERS} stdlib.h) - ENDIF(HAVE_STDLIB_H) + if(HAVE_STDLIB_H) + set(HEADERS ${HEADERS} stdlib.h) + endif() - IF(HAVE_STDINT_H) - SET(HEADERS ${HEADERS} stdint.h) - ENDIF(HAVE_STDINT_H) + if(HAVE_STDINT_H) + set(HEADERS ${HEADERS} stdint.h) + endif() - IF(HAVE_STDDEF_H) - SET(HEADERS ${HEADERS} stddef.h) - ENDIF(HAVE_STDDEF_H) + if(HAVE_STDDEF_H) + set(HEADERS ${HEADERS} stddef.h) + endif() - IF(HAVE_NETDB_H) - SET(HEADERS ${HEADERS} netdb.h) - ENDIF(HAVE_NETDB_H) + if(HAVE_NETDB_H) + set(HEADERS ${HEADERS} netdb.h) + endif() - IF(HAVE_SYS_FILE_H) - SET(HEADERS ${HEADERS} sys/file.h) - ENDIF(HAVE_SYS_FILE_H) + if(HAVE_SYS_FILE_H) + set(HEADERS ${HEADERS} sys/file.h) + endif() - IF(HAVE_STRING_H) - SET(HEADERS ${HEADERS} string.h) - ENDIF(HAVE_STRING_H) + if(HAVE_STRING_H) + set(HEADERS ${HEADERS} string.h) + endif() - IF(HAVE_STRINGS_H) - SET(HEADERS ${HEADERS} strings.h) - ENDIF(HAVE_STRINGS_H) + if(HAVE_STRINGS_H) + set(HEADERS ${HEADERS} strings.h) + endif() - IF(HAVE_SYS_WAIT_H) - SET(HEADERS ${HEADERS} sys/wait.h) - ENDIF(HAVE_SYS_WAIT_H) + if(HAVE_SYS_WAIT_H) + set(HEADERS ${HEADERS} sys/wait.h) + endif() - IF(HAVE_SYS_TIME_H) - SET(HEADERS ${HEADERS} sys/time.h) - ENDIF(HAVE_SYS_TIME_H) + if(HAVE_SYS_TIME_H) + set(HEADERS ${HEADERS} sys/time.h) + endif() - IF(HAVE_SYS_RESOURCE_H) - SET(HEADERS ${HEADERS} sys/resource.h) - ENDIF(HAVE_SYS_RESOURCE_H) + if(HAVE_SYS_RESOURCE_H) + set(HEADERS ${HEADERS} sys/resource.h) + endif() - IF(HAVE_SYS_TYPES_H) - SET(HEADERS ${HEADERS} sys/types.h) - ENDIF(HAVE_SYS_TYPES_H) + if(HAVE_SYS_TYPES_H) + set(HEADERS ${HEADERS} sys/types.h) + endif() - IF(HAVE_SYS_SOCKET_H) - SET(HEADERS ${HEADERS} sys/socket.h) - ENDIF(HAVE_SYS_SOCKET_H) + if(HAVE_SYS_SOCKET_H) + set(HEADERS ${HEADERS} sys/socket.h) + endif() - IF(HAVE_STDARG_H) - SET(HEADERS ${HEADERS} stdarg.h) - ENDIF(HAVE_STDARG_H) + if(HAVE_STDARG_H) + set(HEADERS ${HEADERS} stdarg.h) + endif() - IF(HAVE_STDIO_H) - SET(HEADERS ${HEADERS} stdio.h) - ENDIF(HAVE_STDIO_H) + if(HAVE_STDIO_H) + set(HEADERS ${HEADERS} stdio.h) + endif() - IF(HAVE_SYS_SELECT_H) - SET(HEADERS ${HEADERS} sys/select.h) - ENDIF(HAVE_SYS_SELECT_H) + if(HAVE_SYS_SELECT_H) + set(HEADERS ${HEADERS} sys/select.h) + endif() - IF(HAVE_WINDOWS_H) - SET(HEADERS ${HEADERS} windows.h) - ENDIF(HAVE_WINDOWS_H) + if(HAVE_WINDOWS_H) + set(HEADERS ${HEADERS} windows.h) + endif() - IF(HAVE_GRP_H) - SET(HEADERS ${HEADERS} grp.h) - ENDIF(HAVE_GRP_H) + if(HAVE_GRP_H) + set(HEADERS ${HEADERS} grp.h) + endif() - IF(HAVE_PWD_H) - SET(HEADERS ${HEADERS} pwd.h) - ENDIF(HAVE_PWD_H) + if(HAVE_PWD_H) + set(HEADERS ${HEADERS} pwd.h) + endif() - IF(HAVE_DIRENT_H) - SET(HEADERS ${HEADERS} dirent.h) - ENDIF(HAVE_DIRENT_H) + if(HAVE_DIRENT_H) + set(HEADERS ${HEADERS} dirent.h) + endif() - IF(HAVE_SYS_SYSCALL_H) - SET(HEADERS ${HEADERS} sys/syscall.h) - ENDIF(HAVE_SYS_SYSCALL_H) + if(HAVE_SYS_SYSCALL_H) + set(HEADERS ${HEADERS} sys/syscall.h) + endif() - IF(HAVE_WINSOCK_H) - SET(HEADERS ${HEADERS} winsock.h) - SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} iphlpapi ws2_32 netapi32 wsock32) - ENDIF(HAVE_WINSOCK_H) + if(HAVE_WINSOCK_H) + set(HEADERS ${HEADERS} winsock.h) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} iphlpapi ws2_32 netapi32 wsock32) + endif() - IF(HAVE_FENV_H) - SET(HEADERS ${HEADERS} fenv.h) - ENDIF(HAVE_FENV_H) + if(HAVE_FENV_H) + set(HEADERS ${HEADERS} fenv.h) + endif() # std::vsnprintf and std::vsnprintf need the C++ version of the headers. # We just assume they exist when the C version was found - SET(CXXHEADERS) + set(CXXHEADERS) - IF(HAVE_CSTDIO) - SET(CXXHEADERS ${CXXHEADERS} cstdio) - ENDIF(HAVE_CSTDIO) + if(HAVE_CSTDIO) + set(CXXHEADERS ${CXXHEADERS} cstdio) + endif() - IF(HAVE_CSTDARG) - SET(CXXHEADERS ${CXXHEADERS} cstdarg) - ENDIF(HAVE_CSTDARG) + if(HAVE_CSTDARG) + set(CXXHEADERS ${CXXHEADERS} cstdarg) + endif() - IF(HAVE_CSTDINT) - SET(CXXHEADERS ${CXXHEADERS} cstdint) - ENDIF(HAVE_CSTDINT) + if(HAVE_CSTDINT) + set(CXXHEADERS ${CXXHEADERS} cstdint) + endif() - IF(HAVE_CSTDDEF) - SET(CXXHEADERS ${CXXHEADERS} cstddef) - ENDIF(HAVE_CSTDDEF) + if(HAVE_CSTDDEF) + set(CXXHEADERS ${CXXHEADERS} cstddef) + endif() CHECK_FUNCTIONWITHHEADER_EXISTS(feenableexcept "${HEADERS}" HAVE_PROTOTYPE_FEENABLEEXCEPT) CHECK_FUNCTIONWITHHEADER_EXISTS("isinf(0.)" "${HEADERS}" HAVE_PROTOTYPE_ISINF) @@ -670,25 +670,25 @@ ENDIF() # Signal handling functions CHECK_FUNCTIONWITHHEADER_EXISTS("sigjmp_buf definition" "setjmp.h" HAVE_SIGJMP_BUF) -IF(DCMTK_WITH_OPENSSL) +if(DCMTK_WITH_OPENSSL) # Check if OpenSSL provides the SSL_CTX_get0_param function CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_CTX_get0_param" "openssl/ssl.h" HAVE_SSL_CTX_GET0_PARAM ${OPENSSL_LIBS}) CHECK_FUNCTIONWITHHEADER_EXISTS("RAND_egd" "openssl/rand.h" HAVE_RAND_EGD ${OPENSSL_LIBS}) -ENDIF(DCMTK_WITH_OPENSSL) +endif() -IF(HAVE_LOCKF AND ANDROID) +if(HAVE_LOCKF AND ANDROID) # When Android introduced lockf, they forgot to put the constants like F_LOCK in the # appropriate headers, this tests if they are defined and disables lockf if they are not CHECK_FUNCTIONWITHHEADER_EXISTS("lockf(0, F_LOCK, 0)" "${HEADERS}" HAVE_LOCKF_CONSTANTS) - IF(NOT HAVE_LOCKF_CONSTANTS) - SET(HAVE_LOCKF FALSE CACHE INTERNAL "lockf implementation is broken") - ENDIF() -ENDIF(HAVE_LOCKF AND ANDROID) + if(NOT HAVE_LOCKF_CONSTANTS) + set(HAVE_LOCKF FALSE CACHE INTERNAL "lockf implementation is broken") + endif() +endif() # Tests that require a try-compile -IF(HAVE_MATH_H) - IF(HAVE_LIBC_H) +if(HAVE_MATH_H) + if(HAVE_LIBC_H) # checks if and cause a problem if libc.h is included extern "C" # and math.h is not. This is the case on QNX 6.2.x and 6.5.x. DCMTK_TRY_COMPILE(INCLUDE_LIBC_H_AS_EXTERN_C " can be included as extern \"C\"" @@ -701,12 +701,12 @@ int main() int i = 0; return 0; }") - IF(INCLUDE_LIBC_H_AS_EXTERN_C) - SET(INCLUDE_LIBC_H_AS_CXX 0 CACHE INTERNAL "libc.h should be treated as a C++ header") - ELSE() - SET(INCLUDE_LIBC_H_AS_CXX 1 CACHE INTERNAL "libc.h should be treated as a C++ header") - ENDIF() - ENDIF(HAVE_LIBC_H) + if(INCLUDE_LIBC_H_AS_EXTERN_C) + set(INCLUDE_LIBC_H_AS_CXX 0 CACHE INTERNAL "libc.h should be treated as a C++ header") + else() + set(INCLUDE_LIBC_H_AS_CXX 1 CACHE INTERNAL "libc.h should be treated as a C++ header") + endif() + endif() # checks if must be included as a C++ include file (i.e. without extern "C"). # Some sytems (Win32, HP/UX 10) use C++ language features in . @@ -719,31 +719,31 @@ int main() int i = 0; return 0; }") - IF(INCLUDE_MATH_H_AS_EXTERN_C) - SET(INCLUDE_MATH_H_AS_CXX 0 CACHE INTERNAL "math.h should be treated as a C++ header") - ELSE() - SET(INCLUDE_MATH_H_AS_CXX 1 CACHE INTERNAL "math.h should be treated as a C++ header") - ENDIF() -ENDIF(HAVE_MATH_H) + if(INCLUDE_MATH_H_AS_EXTERN_C) + set(INCLUDE_MATH_H_AS_CXX 0 CACHE INTERNAL "math.h should be treated as a C++ header") + else() + set(INCLUDE_MATH_H_AS_CXX 1 CACHE INTERNAL "math.h should be treated as a C++ header") + endif() +endif() -IF(NOT DEFINED C_CHAR_UNSIGNED) - MESSAGE(STATUS "Checking signedness of char") +if(NOT DEFINED C_CHAR_UNSIGNED) + message(STATUS "Checking signedness of char") DCMTK_TRY_RUN(C_CHAR_SIGNED C_CHAR_SIGNED_COMPILED "${CMAKE_BINARY_DIR}/CMakeTmp/Char" "${DCMTK_SOURCE_DIR}/CMake/dcmtkTestCharSignedness.cc" COMPILE_OUTPUT_VARIABLE C_CHAR_SIGNED_COMPILE_OUTPUT) - IF(C_CHAR_SIGNED_COMPILED) - IF(C_CHAR_SIGNED) - MESSAGE(STATUS "Checking signedness of char -- signed") - SET(C_CHAR_UNSIGNED 0 CACHE INTERNAL "Whether char is unsigned.") - ELSE(C_CHAR_SIGNED) - MESSAGE(STATUS "Checking signedness of char -- unsigned") - SET(C_CHAR_UNSIGNED 1 CACHE INTERNAL "Whether char is unsigned.") - ENDIF(C_CHAR_SIGNED) - ELSE(C_CHAR_SIGNED_COMPILED) - MESSAGE(STATUS "Checking signedness of char -- failed") - ENDIF(C_CHAR_SIGNED_COMPILED) -ENDIF(NOT DEFINED C_CHAR_UNSIGNED) + if(C_CHAR_SIGNED_COMPILED) + if(C_CHAR_SIGNED) + message(STATUS "Checking signedness of char -- signed") + set(C_CHAR_UNSIGNED 0 CACHE INTERNAL "Whether char is unsigned.") + else() + message(STATUS "Checking signedness of char -- unsigned") + set(C_CHAR_UNSIGNED 1 CACHE INTERNAL "Whether char is unsigned.") + endif() + else() + message(STATUS "Checking signedness of char -- failed") + endif() +endif() DCMTK_TRY_COMPILE(HAVE_CXX_BOOL "C++ type bool exists" "// Minimal test for existence of 'bool' type. @@ -757,9 +757,9 @@ int main() }") # Check for thread type -IF(HAVE_WINDOWS_H) - SET(HAVE_INT_TYPE_PTHREAD_T 1) -ELSE(HAVE_WINDOWS_H) +if(HAVE_WINDOWS_H) + set(HAVE_INT_TYPE_PTHREAD_T 1) +else() DCMTK_TRY_COMPILE(HAVE_INT_TYPE_PTHREAD_T "pthread_t is an integer type" "// test to see if pthread_t is a pointer type or not @@ -771,12 +771,12 @@ int main () unsigned long l = p; return 0; }") - IF(NOT HAVE_INT_TYPE_PTHREAD_T) - SET(HAVE_POINTER_TYPE_PTHREAD_T 1 CACHE INTERNAL "Set if pthread_t is a pointer type") - ELSE(NOT HAVE_INT_TYPE_PTHREAD_T) - SET(HAVE_POINTER_TYPE_PTHREAD_T 0 CACHE INTERNAL "Set if pthread_t is a pointer type") - ENDIF(NOT HAVE_INT_TYPE_PTHREAD_T) -ENDIF(HAVE_WINDOWS_H) + if(NOT HAVE_INT_TYPE_PTHREAD_T) + set(HAVE_POINTER_TYPE_PTHREAD_T 1 CACHE INTERNAL "Set if pthread_t is a pointer type") + else() + set(HAVE_POINTER_TYPE_PTHREAD_T 0 CACHE INTERNAL "Set if pthread_t is a pointer type") + endif() +endif() # Check if typename works properly. Only MSC6 really fails here. DCMTK_TRY_COMPILE(HAVE_TYPENAME "typename works correctly" @@ -825,11 +825,11 @@ int main() int i = strerror_r(0, buf, 100); return i; }") -IF(HAVE_INT_STRERROR_R) - SET(HAVE_CHARP_STRERROR_R 0 CACHE INTERNAL "Set if strerror_r() returns a char*") -ELSE(HAVE_INT_STRERROR_R) - SET(HAVE_CHARP_STRERROR_R 1 CACHE INTERNAL "Set if strerror_r() returns a char*") -ENDIF(HAVE_INT_STRERROR_R) +if(HAVE_INT_STRERROR_R) + set(HAVE_CHARP_STRERROR_R 0 CACHE INTERNAL "Set if strerror_r() returns a char*") +else() + set(HAVE_CHARP_STRERROR_R 1 CACHE INTERNAL "Set if strerror_r() returns a char*") +endif() # Check if variable length arrays are supported. DCMTK_TRY_COMPILE(HAVE_VLA "variable length arrays are supported" @@ -853,235 +853,235 @@ int main() }") # do try compile to detect lfs and flags -FUNCTION(DCMTK_LFS_TRY_COMPILE VAR FILE FLAGS DEFINITIONS) - IF(FLAGS OR DEFINITIONS) - SET(OPTIONS " with arguments: \"") - ELSE() - SET(OPTIONS) - ENDIF() - IF(DCMTK_TRY_COMPILE_REQUIRED_CMAKE_FLAGS OR FLAGS) - SET(CMAKE_FLAGS CMAKE_FLAGS ${DCMTK_TRY_COMPILE_REQUIRED_CMAKE_FLAGS}) - IF(FLAGS) - LIST(APPEND CMAKE_FLAGS "-DCMAKE_C_FLAGS:STRING=${FLAGS}") - SET(OPTIONS "${OPTIONS}${FLAGS}") - ENDIF() - ELSE() - SET(CMAKE_FLAGS) - ENDIF() - IF(DEFINITIONS) - SET(COMPILE_DEFINITIONS COMPILE_DEFINITIONS ${DEFINITIONS}) - IF(FLAGS) - SET(OPTIONS "${OPTIONS} ") - ENDIF() - SET(OPTIONS "${OPTIONS}${DEFINITIONS}") - ELSE() - SET(COMPILE_DEFINITIONS) - ENDIF() - IF(FLAGS OR DEFINITIONS) - SET(OPTIONS "${OPTIONS}\"") - ENDIF() - SET(SOURCEFILE "${DCMTK_SOURCE_DIR}/config/tests/${FILE}") - TRY_COMPILE(RESULT +function(DCMTK_LFS_TRY_COMPILE VAR FILE FLAGS DEFINITIONS) + if(FLAGS OR DEFINITIONS) + set(OPTIONS " with arguments: \"") + else() + set(OPTIONS) + endif() + if(DCMTK_TRY_COMPILE_REQUIRED_CMAKE_FLAGS OR FLAGS) + set(CMAKE_FLAGS CMAKE_FLAGS ${DCMTK_TRY_COMPILE_REQUIRED_CMAKE_FLAGS}) + if(FLAGS) + list(APPEND CMAKE_FLAGS "-DCMAKE_C_FLAGS:STRING=${FLAGS}") + set(OPTIONS "${OPTIONS}${FLAGS}") + endif() + else() + set(CMAKE_FLAGS) + endif() + if(DEFINITIONS) + set(COMPILE_DEFINITIONS COMPILE_DEFINITIONS ${DEFINITIONS}) + if(FLAGS) + set(OPTIONS "${OPTIONS} ") + endif() + set(OPTIONS "${OPTIONS}${DEFINITIONS}") + else() + set(COMPILE_DEFINITIONS) + endif() + if(FLAGS OR DEFINITIONS) + set(OPTIONS "${OPTIONS}\"") + endif() + set(SOURCEFILE "${DCMTK_SOURCE_DIR}/config/tests/${FILE}") + try_compile(RESULT "${CMAKE_BINARY_DIR}" "${SOURCEFILE}" ${CMAKE_FLAGS} ${COMPILE_DEFINITIONS} OUTPUT_VARIABLE OUTPUT ) - SET("${VAR}" "${RESULT}" PARENT_SCOPE) - IF(RESULT) - SET(LOGFILE "CMakeOutput.log") - SET(LOG "succeded") - ELSE() - SET(LOGFILE "CMakeError.log") - SET(LOG "failed") - ENDIF() - FILE(TO_NATIVE_PATH "${SOURCEFILE}" SOURCEFILE) - FILE(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${LOGFILE}" + set("${VAR}" "${RESULT}" PARENT_SCOPE) + if(RESULT) + set(LOGFILE "CMakeOutput.log") + set(LOG "succeded") + else() + set(LOGFILE "CMakeError.log") + set(LOG "failed") + endif() + file(TO_NATIVE_PATH "${SOURCEFILE}" SOURCEFILE) + file(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${LOGFILE}" "compiling \"${SOURCEFILE}\"${OPTIONS} ${LOG} with the following output:\n" "${OUTPUT}\n" ) -ENDFUNCTION(DCMTK_LFS_TRY_COMPILE) +endfunction() -FUNCTION(DCMTK_CHECK_ENABLE_LFS) +function(DCMTK_CHECK_ENABLE_LFS) # normalize arguments - IF(DCMTK_ENABLE_LFS) + if(DCMTK_ENABLE_LFS) # for cases insensitive comparison - STRING(TOLOWER "${DCMTK_ENABLE_LFS}" DCMTK_ENABLE_LFS) - ENDIF() - IF(NOT DCMTK_ENABLE_LFS OR DCMTK_ENABLE_LFS MATCHES "^(on|true|yes|1)$") - SET(DCMTK_ENABLE_LFS "auto") - ELSEIF(DCMTK_ENABLE_LFS MATCHES "^(no|false|0)$") - SET(DCMTK_ENABLE_LFS "off") - ENDIF() + string(TOLOWER "${DCMTK_ENABLE_LFS}" DCMTK_ENABLE_LFS) + endif() + if(NOT DCMTK_ENABLE_LFS OR DCMTK_ENABLE_LFS MATCHES "^(on|true|yes|1)$") + set(DCMTK_ENABLE_LFS "auto") + elseif(DCMTK_ENABLE_LFS MATCHES "^(no|false|0)$") + set(DCMTK_ENABLE_LFS "off") + endif() # determin whether lfs64 is available in case it wasn't detected yet it may be used - IF(NOT DEFINED DCMTK_LFS64_AVAILABLE AND DCMTK_ENABLE_LFS MATCHES "^(lfs64|auto)$") - SET(DCMTK_LFS64_DEFINITIONS) - SET(MESSAGE_RESULT "no") - SET(MESSAGE "Checking whether explicit large file support (LFS64) is available") - MESSAGE(STATUS "${MESSAGE}") + if(NOT DEFINED DCMTK_LFS64_AVAILABLE AND DCMTK_ENABLE_LFS MATCHES "^(lfs64|auto)$") + set(DCMTK_LFS64_DEFINITIONS) + set(MESSAGE_RESULT "no") + set(MESSAGE "Checking whether explicit large file support (LFS64) is available") + message(STATUS "${MESSAGE}") DCMTK_LFS_TRY_COMPILE(RESULT "lfs64.cc" "" "") - IF(NOT RESULT) + if(NOT RESULT) DCMTK_LFS_TRY_COMPILE(RESULT "lfs64.cc" "" "-D_LARGEFILE64_SOURCE") - IF(RESULT) - SET(DCMTK_LFS64_DEFINITIONS "-D_LARGEFILE64_SOURCE") - SET(MESSAGE_RESULT "yes, with ${DCMTK_LFS64_DEFINITIONS}") - ENDIF() - ELSE() - SET(MESSAGE_RESULT "yes") - ENDIF() - IF(RESULT) - SET(DCMTK_ENABLE_LFS "lfs64") - SET(DCMTK_LFS64_DEFINITIONS "${DCMTK_LFS64_DEFINITIONS}" CACHE INTERNAL "which compiler definitions to set for enabling LFS64 support") - ENDIF() - SET(DCMTK_LFS64_AVAILABLE "${RESULT}" CACHE INTERNAL "whether LFS64 is available or not" FORCE) - MESSAGE(STATUS "${MESSAGE} -- ${MESSAGE_RESULT}") - ENDIF() + if(RESULT) + set(DCMTK_LFS64_DEFINITIONS "-D_LARGEFILE64_SOURCE") + set(MESSAGE_RESULT "yes, with ${DCMTK_LFS64_DEFINITIONS}") + endif() + else() + set(MESSAGE_RESULT "yes") + endif() + if(RESULT) + set(DCMTK_ENABLE_LFS "lfs64") + set(DCMTK_LFS64_DEFINITIONS "${DCMTK_LFS64_DEFINITIONS}" CACHE INTERNAL "which compiler definitions to set for enabling LFS64 support") + endif() + set(DCMTK_LFS64_AVAILABLE "${RESULT}" CACHE INTERNAL "whether LFS64 is available or not" FORCE) + message(STATUS "${MESSAGE} -- ${MESSAGE_RESULT}") + endif() # determin whether lfs is available in case it wasn't detected yet it may be used - IF(NOT DEFINED DCMTK_LFS_AVAILABLE AND DCMTK_ENABLE_LFS MATCHES "^(lfs|auto)$") - SET(DCMTK_LFS_FLAGS) - SET(DCMTK_LFS_DEFINITIONS) - SET(MESSAGE_RESULT "no") - SET(MESSAGE "Checking whether large file support (LFS) is available") - MESSAGE(STATUS "${MESSAGE}") + if(NOT DEFINED DCMTK_LFS_AVAILABLE AND DCMTK_ENABLE_LFS MATCHES "^(lfs|auto)$") + set(DCMTK_LFS_FLAGS) + set(DCMTK_LFS_DEFINITIONS) + set(MESSAGE_RESULT "no") + set(MESSAGE "Checking whether large file support (LFS) is available") + message(STATUS "${MESSAGE}") # determine size of fpos_t (for the strange LFS implementation on Windows) - SET(CMAKE_EXTRA_INCLUDE_FILES) - IF(HAVE_STDIO_H) + set(CMAKE_EXTRA_INCLUDE_FILES) + if(HAVE_STDIO_H) # prefer stdio.h so that is not in namespace std - SET(CMAKE_EXTRA_INCLUDE_FILES "stdio.h") - ELSEIF(HAVE_CSTDIO) + set(CMAKE_EXTRA_INCLUDE_FILES "stdio.h") + elseif(HAVE_CSTDIO) # use cstdio as the fallback - SET(CMAKE_EXTRA_INCLUDE_FILES "cstdio") - ENDIF() + set(CMAKE_EXTRA_INCLUDE_FILES "cstdio") + endif() CHECK_TYPE_SIZE("fpos_t" SIZEOF_FPOS_T) # assume sizeof off_t to be correct, will be removed if below tests fail - SET(SIZEOF_OFF_T 8) + set(SIZEOF_OFF_T 8) # try compile different combinations of compiler flags and definitions DCMTK_LFS_TRY_COMPILE(RESULT "lfs.c" "" "") - IF(NOT RESULT) - SET(DCMTK_LFS_FLAGS "-n32") + if(NOT RESULT) + set(DCMTK_LFS_FLAGS "-n32") DCMTK_LFS_TRY_COMPILE(RESULT "lfs.c" "-n32" "") - ENDIF() - IF(NOT RESULT) - SET(DCMTK_LFS_FLAGS "") - SET(DCMTK_LFS_DEFINITIONS "-D_FILE_OFFSET_BITS=64") + endif() + if(NOT RESULT) + set(DCMTK_LFS_FLAGS "") + set(DCMTK_LFS_DEFINITIONS "-D_FILE_OFFSET_BITS=64") DCMTK_LFS_TRY_COMPILE(RESULT "lfs.c" "" "-D_FILE_OFFSET_BITS=64") - ENDIF() - IF(NOT RESULT) - SET(DCMTK_LFS_FLAGS "-n32") - SET(DCMTK_LFS_DEFINITIONS "-D_FILE_OFFSET_BITS=64") + endif() + if(NOT RESULT) + set(DCMTK_LFS_FLAGS "-n32") + set(DCMTK_LFS_DEFINITIONS "-D_FILE_OFFSET_BITS=64") DCMTK_LFS_TRY_COMPILE(RESULT "lfs.c" "-n32" "-D_FILE_OFFSET_BITS=64") - ENDIF() - IF(NOT RESULT) - SET(DCMTK_LFS_FLAGS "") - SET(DCMTK_LFS_DEFINITIONS "-D_LARGE_FILES=1") + endif() + if(NOT RESULT) + set(DCMTK_LFS_FLAGS "") + set(DCMTK_LFS_DEFINITIONS "-D_LARGE_FILES=1") DCMTK_LFS_TRY_COMPILE(RESULT "lfs.c" "" "-D_LARGE_FILES=1") - ENDIF() - IF(NOT RESULT) - SET(DCMTK_LFS_FLAGS "-n32") - SET(DCMTK_LFS_DEFINITIONS "-D_LARGE_FILES=1") + endif() + if(NOT RESULT) + set(DCMTK_LFS_FLAGS "-n32") + set(DCMTK_LFS_DEFINITIONS "-D_LARGE_FILES=1") DCMTK_LFS_TRY_COMPILE(RESULT "lfs.c" "-n32" "-D_LARGE_FILES=1") - ENDIF() - IF(NOT RESULT) + endif() + if(NOT RESULT) # remove flags and reset SIZEOF_OFF_T to indeterminate - SET(DCMTK_LFS_FLAGS) - SET(DCMTK_LFS_DEFINITIONS) - SET(SIZEOF_OFF_T) + set(DCMTK_LFS_FLAGS) + set(DCMTK_LFS_DEFINITIONS) + set(SIZEOF_OFF_T) # detect strange LFS implementation that (at least) Windows provides # strange since sizeof(fpos_t) == 8 but sizeof(off_t) == 4! - IF(SIZEOF_FPOS_T EQUAL 8) - SET(RESULT TRUE) - ENDIF() - ENDIF() + if(SIZEOF_FPOS_T EQUAL 8) + set(RESULT TRUE) + endif() + endif() # format a nice result message - IF(RESULT) - SET(DCMTK_ENABLE_LFS "lfs") - SET(DCMTK_LFS_FLAGS "${DCMTK_LFS_FLAGS}" CACHE INTERNAL "which compiler flags to set for enabling LFS support") - SET(DCMTK_LFS_DEFINITIONS "${DCMTK_LFS_DEFINITIONS}" CACHE INTERNAL "which compiler definitions to set for enabling LFS support") - SET(MESSAGE_RESULT "yes") - IF(NOT DCMTK_LFS_FLAGS STREQUAL "" OR NOT DCMTK_LFS_DEFINITIONS STREQUAL "") - SET(MESSAGE_RESULT "${MESSAGE_RESULT}, with") - IF(NOT DCMTK_LFS_FLAGS STREQUAL "") - SET(MESSAGE_RESULT "${MESSAGE_RESULT} ${DCMTK_LFS_FLAGS}") - ENDIF() - IF(NOT DCMTK_LFS_DEFINITIONS STREQUAL "") - SET(MESSAGE_RESULT "${MESSAGE_RESULT} ${DCMTK_LFS_DEFINITIONS}") - ENDIF() - ENDIF() - ENDIF() - SET(DCMTK_LFS_AVAILABLE "${RESULT}" CACHE INTERNAL "whether LFS is available or not" FORCE) - IF(DEFINED SIZEOF_OFF_T) - SET(SIZEOF_OFF_T "${SIZEOF_OFF_T}" CACHE INTERNAL "") - ENDIF() - MESSAGE(STATUS "${MESSAGE} -- ${MESSAGE_RESULT}") - ENDIF() + if(RESULT) + set(DCMTK_ENABLE_LFS "lfs") + set(DCMTK_LFS_FLAGS "${DCMTK_LFS_FLAGS}" CACHE INTERNAL "which compiler flags to set for enabling LFS support") + set(DCMTK_LFS_DEFINITIONS "${DCMTK_LFS_DEFINITIONS}" CACHE INTERNAL "which compiler definitions to set for enabling LFS support") + set(MESSAGE_RESULT "yes") + if(NOT DCMTK_LFS_FLAGS STREQUAL "" OR NOT DCMTK_LFS_DEFINITIONS STREQUAL "") + set(MESSAGE_RESULT "${MESSAGE_RESULT}, with") + if(NOT DCMTK_LFS_FLAGS STREQUAL "") + set(MESSAGE_RESULT "${MESSAGE_RESULT} ${DCMTK_LFS_FLAGS}") + endif() + if(NOT DCMTK_LFS_DEFINITIONS STREQUAL "") + set(MESSAGE_RESULT "${MESSAGE_RESULT} ${DCMTK_LFS_DEFINITIONS}") + endif() + endif() + endif() + set(DCMTK_LFS_AVAILABLE "${RESULT}" CACHE INTERNAL "whether LFS is available or not" FORCE) + if(DEFINED SIZEOF_OFF_T) + set(SIZEOF_OFF_T "${SIZEOF_OFF_T}" CACHE INTERNAL "") + endif() + message(STATUS "${MESSAGE} -- ${MESSAGE_RESULT}") + endif() # auto-select LFS implementation in case this is not the first run and the above tests did not select it - IF(DCMTK_ENABLE_LFS STREQUAL "auto") - IF(DCMTK_LFS64_AVAILABLE) - SET(DCMTK_ENABLE_LFS "lfs64") - ELSEIF(DCMTK_LFS_AVAILABLE) - SET(DCMTK_ENABLE_LFS "lfs") - ELSE() - SET(DCMTK_ENABLE_LFS "off") - ENDIF() - ELSEIF(NOT DCMTK_ENABLE_LFS MATCHES "^(lfs|lfs64|off)$") + if(DCMTK_ENABLE_LFS STREQUAL "auto") + if(DCMTK_LFS64_AVAILABLE) + set(DCMTK_ENABLE_LFS "lfs64") + elseif(DCMTK_LFS_AVAILABLE) + set(DCMTK_ENABLE_LFS "lfs") + else() + set(DCMTK_ENABLE_LFS "off") + endif() + elseif(NOT DCMTK_ENABLE_LFS MATCHES "^(lfs|lfs64|off)$") # print a warning in case the given argument was not understood - MESSAGE(WARNING "unknown argument \"${DCMTK_ENABLE_LFS}\" for DCMTK_ENABLE_LFS, setting it to \"off\"") - SET(DCMTK_ENABLE_LFS "off") - ELSEIF(DCMTK_ENABLE_LFS STREQUAL "lfs64" AND NOT DCMTK_LFS64_AVAILABLE) + message(WARNING "unknown argument \"${DCMTK_ENABLE_LFS}\" for DCMTK_ENABLE_LFS, setting it to \"off\"") + set(DCMTK_ENABLE_LFS "off") + elseif(DCMTK_ENABLE_LFS STREQUAL "lfs64" AND NOT DCMTK_LFS64_AVAILABLE) # test if the explicitly chosen implementation is really available - MESSAGE(WARNING "LFS64 was enabled but LFS64 support is not available, focing DCMTK_ENABLE_LFS to \"off\"") - SET(DCMTK_ENABLE_LFS "off") - ELSEIF(DCMTK_ENABLE_LFS STREQUAL "lfs" AND NOT DCMTK_LFS_AVAILABLE) + message(WARNING "LFS64 was enabled but LFS64 support is not available, focing DCMTK_ENABLE_LFS to \"off\"") + set(DCMTK_ENABLE_LFS "off") + elseif(DCMTK_ENABLE_LFS STREQUAL "lfs" AND NOT DCMTK_LFS_AVAILABLE) # test if the explicitly chosen implementation is really available - MESSAGE(WARNING "LFS was enabled but LFS support is not available, focing DCMTK_ENABLE_LFS to \"off\"") - SET(DCMTK_ENABLE_LFS "off") - ENDIF() + message(WARNING "LFS was enabled but LFS support is not available, focing DCMTK_ENABLE_LFS to \"off\"") + set(DCMTK_ENABLE_LFS "off") + endif() # create a list of available LFS types for the CMake GUI - SET(AVAILABLE_LFS_TYPES) - IF(NOT DEFINED DCMTK_LFS64_AVAILABLE OR DCMTK_LFS64_AVAILABLE) - LIST(APPEND AVAILABLE_LFS_TYPES "lfs64") - ENDIF() - IF(NOT DEFINED DCMTK_LFS_AVAILABLE OR DCMTK_LFS_AVAILABLE) - LIST(APPEND AVAILABLE_LFS_TYPES "lfs") - ENDIF() + set(AVAILABLE_LFS_TYPES) + if(NOT DEFINED DCMTK_LFS64_AVAILABLE OR DCMTK_LFS64_AVAILABLE) + list(APPEND AVAILABLE_LFS_TYPES "lfs64") + endif() + if(NOT DEFINED DCMTK_LFS_AVAILABLE OR DCMTK_LFS_AVAILABLE) + list(APPEND AVAILABLE_LFS_TYPES "lfs") + endif() # store the chosen value to the cache (potentially normalizing the given argument) - SET(DCMTK_ENABLE_LFS "${DCMTK_ENABLE_LFS}" CACHE STRING "whether to use lfs/lfs64 or not" FORCE) - SET_PROPERTY(CACHE DCMTK_ENABLE_LFS PROPERTY STRINGS "auto" ${AVAILABLE_LFS_TYPES} "off") + set(DCMTK_ENABLE_LFS "${DCMTK_ENABLE_LFS}" CACHE STRING "whether to use lfs/lfs64 or not" FORCE) + set_property(CACHE DCMTK_ENABLE_LFS PROPERTY STRINGS "auto" ${AVAILABLE_LFS_TYPES} "off") # set values for osconfig.h and add compiler flags and definitions (if necessary) - IF(DCMTK_ENABLE_LFS STREQUAL "lfs64") + if(DCMTK_ENABLE_LFS STREQUAL "lfs64") # set the value for generating osconfig.h - SET(DCMTK_LFS_MODE "DCMTK_LFS64" CACHE INTERNAL "" FORCE) - IF(NOT DCMTK_LFS64_DEFINITIONS STREQUAL "") - ADD_DEFINITIONS(${DCMTK_LFS64_DEFINITIONS}) - ENDIF() - MESSAGE(STATUS "Info: Building DCMTK with explicit large file support (LFS64)") - ELSEIF(DCMTK_ENABLE_LFS STREQUAL "lfs") + set(DCMTK_LFS_MODE "DCMTK_LFS64" CACHE INTERNAL "" FORCE) + if(NOT DCMTK_LFS64_DEFINITIONS STREQUAL "") + add_definitions(${DCMTK_LFS64_DEFINITIONS}) + endif() + message(STATUS "Info: Building DCMTK with explicit large file support (LFS64)") + elseif(DCMTK_ENABLE_LFS STREQUAL "lfs") # set the value for generating osconfig.h - SET(DCMTK_LFS_MODE "DCMTK_LFS" CACHE INTERNAL "" FORCE) - IF(NOT DCMTK_LFS_FLAGS STREQUAL "") - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${DCMTK_LFS_FLAGS}") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DCMTK_LFS_FLAGS}") - ENDIF() - IF(NOT DCMTK_LFS_DEFINITIONS STREQUAL "") - ADD_DEFINITIONS(${DCMTK_LFS_DEFINITIONS}) - ENDIF() - MESSAGE(STATUS "Info: Building DCMTK with large file support (LFS)") - ELSE() - SET(DCMTK_ENABLE_LFS) - MESSAGE(STATUS "Info: Building DCMTK without large file support, files >4GB may be inaccesible!") - ENDIF() -ENDFUNCTION(DCMTK_CHECK_ENABLE_LFS) + set(DCMTK_LFS_MODE "DCMTK_LFS" CACHE INTERNAL "" FORCE) + if(NOT DCMTK_LFS_FLAGS STREQUAL "") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${DCMTK_LFS_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DCMTK_LFS_FLAGS}") + endif() + if(NOT DCMTK_LFS_DEFINITIONS STREQUAL "") + add_definitions(${DCMTK_LFS_DEFINITIONS}) + endif() + message(STATUS "Info: Building DCMTK with large file support (LFS)") + else() + set(DCMTK_ENABLE_LFS) + message(STATUS "Info: Building DCMTK without large file support, files >4GB may be inaccesible!") + endif() +endfunction() DCMTK_CHECK_ENABLE_LFS() -IF(WIN32) +if(WIN32) # If someone can tell me how to convince TRY_COMPILE to link against winsock, # we could use tests for these. Until then, here is what would be the result: - SET(HAVE_INTP_ACCEPT 1 CACHE INTERNAL "Set if socket functions accept an int* argument") - SET(HAVE_INTP_GETSOCKOPT 1 CACHE INTERNAL "Set if socket functions accept an int* argument") - SET(HAVE_INTP_SELECT 0 CACHE INTERNAL "Set if select() accepts an int* argument") -ELSE(WIN32) + set(HAVE_INTP_ACCEPT 1 CACHE INTERNAL "Set if socket functions accept an int* argument") + set(HAVE_INTP_GETSOCKOPT 1 CACHE INTERNAL "Set if socket functions accept an int* argument") + set(HAVE_INTP_SELECT 0 CACHE INTERNAL "Set if select() accepts an int* argument") +else() # Check if socket functions accept an int* DCMTK_TRY_COMPILE(HAVE_INTP_SOCKET, "socket functions accept an int* argument" " @@ -1110,13 +1110,13 @@ int main() return 0; }") - IF(HAVE_INTP_SOCKET) - SET(HAVE_INTP_ACCEPT 1 CACHE INTERNAL "Set if socket functions accept an int* argument") - SET(HAVE_INTP_GETSOCKOPT 1 CACHE INTERNAL "Set if socket functions accept an int* argument") - ELSE(HAVE_INTP_SOCKET) - SET(HAVE_INTP_ACCEPT 0 CACHE INTERNAL "Set if socket functions accept an int* argument") - SET(HAVE_INTP_GETSOCKOPT 0 CACHE INTERNAL "Set if socket functions accept an int* argument") - ENDIF(HAVE_INTP_SOCKET) + if(HAVE_INTP_SOCKET) + set(HAVE_INTP_ACCEPT 1 CACHE INTERNAL "Set if socket functions accept an int* argument") + set(HAVE_INTP_GETSOCKOPT 1 CACHE INTERNAL "Set if socket functions accept an int* argument") + else() + set(HAVE_INTP_ACCEPT 0 CACHE INTERNAL "Set if socket functions accept an int* argument") + set(HAVE_INTP_GETSOCKOPT 0 CACHE INTERNAL "Set if socket functions accept an int* argument") + endif() # Check if select() accepts an int* DCMTK_TRY_COMPILE(HAVE_INTP_SELECT "select() accepts an int* argument" @@ -1144,7 +1144,7 @@ int main() return 0; } ") -ENDIF(WIN32) +endif() # Check for alignment query / specifier support DCMTK_TRY_COMPILE(HAVE_GNU_ALIGNOF "__alignof__ is supported" @@ -1230,18 +1230,18 @@ int main() }") # Compile config/tests/arith.cc and generate config/arith.h -FUNCTION(INSPECT_FUNDAMENTAL_ARITHMETIC_TYPES) - SET(ARITH_H_FILE "${DCMTK_BINARY_DIR}/config/include/dcmtk/config/arith.h") - IF("${DCMTK_SOURCE_DIR}/config/tests/arith.cc" IS_NEWER_THAN "${ARITH_H_FILE}") - IF(CMAKE_CROSSCOMPILING) - IF(WIN32) +function(INSPECT_FUNDAMENTAL_ARITHMETIC_TYPES) + set(ARITH_H_FILE "${DCMTK_BINARY_DIR}/config/include/dcmtk/config/arith.h") + if("${DCMTK_SOURCE_DIR}/config/tests/arith.cc" IS_NEWER_THAN "${ARITH_H_FILE}") + if(CMAKE_CROSSCOMPILING) + if(WIN32) UNIX_TO_WINE_PATH(ARITH_H_FILE "${ARITH_H_FILE}") - STRING(REPLACE "\\" "\\\\" ARITH_H_FILE "${ARITH_H_FILE}") - ELSEIF(ANDROID) - SET(ARITH_H_DESTINATION "${ARITH_H_FILE}") - SET(ARITH_H_FILE "${ANDROID_TEMPORARY_FILES_LOCATION}/arith.h") - ENDIF() - ENDIF(CMAKE_CROSSCOMPILING) + string(REPLACE "\\" "\\\\" ARITH_H_FILE "${ARITH_H_FILE}") + elseif(ANDROID) + set(ARITH_H_DESTINATION "${ARITH_H_FILE}") + set(ARITH_H_FILE "${ANDROID_TEMPORARY_FILES_LOCATION}/arith.h") + endif() + endif() DCMTK_TRY_RUN( RESULT COMPILED "${DCMTK_BINARY_DIR}/CMakeTmp/Arith" @@ -1251,98 +1251,98 @@ FUNCTION(INSPECT_FUNDAMENTAL_ARITHMETIC_TYPES) COMPILE_OUTPUT_VARIABLE CERR ARGS "\\\"${ARITH_H_FILE}\\\"" ) - IF(COMPILED) - IF(NOT RESULT) - MESSAGE(STATUS "${OUTPUT}") - IF(CMAKE_CROSSCOMPILING) - IF(ANDROID) + if(COMPILED) + if(NOT RESULT) + message(STATUS "${OUTPUT}") + if(CMAKE_CROSSCOMPILING) + if(ANDROID) DCMTK_ANDROID_PULL(DCMTK_ANDROID_EMULATOR_INSTANCE "${ARITH_H_FILE}" DESTINATION "${ARITH_H_DESTINATION}") - ENDIF() - ENDIF(CMAKE_CROSSCOMPILING) - ELSE(NOT RESULT) - MESSAGE(FATAL_ERROR "${OUTPUT}") - ENDIF(NOT RESULT) - ELSE(COMPILED) - MESSAGE(FATAL_ERROR "${CERR}") - ENDIF(COMPILED) - ENDIF() # file needs update -ENDFUNCTION(INSPECT_FUNDAMENTAL_ARITHMETIC_TYPES) - -FUNCTION(DCMTK_ADD_CXX11_FLAGS) - STRING(FIND "${CMAKE_CXX_FLAGS}" "${DCMTK_CXX11_FLAGS}" INDEX) - IF(INDEX EQUAL -1) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DCMTK_CXX11_FLAGS}" PARENT_SCOPE) - ENDIF() -ENDFUNCTION(DCMTK_ADD_CXX11_FLAGS) - -FUNCTION(DCMTK_TEST_ENABLE_CXX11) - SET(RESULT 0) - SET(TEXT_RESULT "disabled") - IF(DCMTK_ENABLE_CXX11) - IF(DEFINED HAVE_CXX11_TEST_RESULT) - IF(HAVE_CXX11_TEST_RESULT) + endif() + endif() + else() + message(FATAL_ERROR "${OUTPUT}") + endif() + else() + message(FATAL_ERROR "${CERR}") + endif() + endif() # file needs update +endfunction() + +function(DCMTK_ADD_CXX11_FLAGS) + string(FIND "${CMAKE_CXX_FLAGS}" "${DCMTK_CXX11_FLAGS}" INDEX) + if(INDEX EQUAL -1) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DCMTK_CXX11_FLAGS}" PARENT_SCOPE) + endif() +endfunction() + +function(DCMTK_TEST_ENABLE_CXX11) + set(RESULT 0) + set(TEXT_RESULT "disabled") + if(DCMTK_ENABLE_CXX11) + if(DEFINED HAVE_CXX11_TEST_RESULT) + if(HAVE_CXX11_TEST_RESULT) DCMTK_ADD_CXX11_FLAGS() - SET(RESULT 1) - SET(TEXT_RESULT "enabled") - ENDIF() - ELSE() + set(RESULT 1) + set(TEXT_RESULT "enabled") + endif() + else() DCMTK_ADD_CXX11_FLAGS() # will automatically be removed by the function scope - SET(MESSAGE "Checking whether the compiler supports C++11") - MESSAGE(STATUS "${MESSAGE}") - TRY_COMPILE(COMPILE_RESULT "${CMAKE_BINARY_DIR}" "${DCMTK_SOURCE_DIR}/config/tests/cxx11.cc") - SET(HAVE_CXX11_TEST_RESULT "${COMPILE_RESULT}" CACHE INTERNAL "Caches the configuration test result for C++11 support.") - IF(COMPILE_RESULT) - SET(RESULT 1) - SET(TEXT_RESULT "enabled") - MESSAGE(STATUS "${MESSAGE} -- yes") - ELSE() - MESSAGE(STATUS "${MESSAGE} -- no") - ENDIF() - ENDIF() - ENDIF() - SET(HAVE_CXX11 "${RESULT}" CACHE INTERNAL "Set to 1 if the compiler supports C++11 and it should be enabled.") - MESSAGE(STATUS "Info: C++11 features ${TEXT_RESULT}") - IF(RESULT) + set(MESSAGE "Checking whether the compiler supports C++11") + message(STATUS "${MESSAGE}") + try_compile(COMPILE_RESULT "${CMAKE_BINARY_DIR}" "${DCMTK_SOURCE_DIR}/config/tests/cxx11.cc") + set(HAVE_CXX11_TEST_RESULT "${COMPILE_RESULT}" CACHE INTERNAL "Caches the configuration test result for C++11 support.") + if(COMPILE_RESULT) + set(RESULT 1) + set(TEXT_RESULT "enabled") + message(STATUS "${MESSAGE} -- yes") + else() + message(STATUS "${MESSAGE} -- no") + endif() + endif() + endif() + set(HAVE_CXX11 "${RESULT}" CACHE INTERNAL "Set to 1 if the compiler supports C++11 and it should be enabled.") + message(STATUS "Info: C++11 features ${TEXT_RESULT}") + if(RESULT) # push C++11 CXX-flags to the parent scope - SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} PARENT_SCOPE) - ENDIF() -ENDFUNCTION(DCMTK_TEST_ENABLE_CXX11) - -FUNCTION(DCMTK_TEST_ENABLE_STL_FEATURE NAME) - STRING(TOUPPER "${NAME}" FEATURE) - IF(ARGN) - SET(SOURCEFILE "${ARGN}") - ELSE() - SET(SOURCEFILE "${NAME}") - ENDIF() - IF(DCMTK_ENABLE_STL_${FEATURE} STREQUAL "INFERRED") - SET(DCMTK_ENABLE_STL_${FEATURE} ${DCMTK_ENABLE_STL}) - ENDIF() - SET(RESULT 0) - SET(TEXT_RESULT "disabled") - IF(DCMTK_ENABLE_STL_${FEATURE} STREQUAL "ON") - IF(DEFINED HAVE_STL_${FEATURE}_TEST_RESULT) - IF(HAVE_STL_${FEATURE}_TEST_RESULT) - SET(RESULT 1) - SET(TEXT_RESULT "enabled") - ENDIF() - ELSE() - SET(MESSAGE "Checking whether STL ${NAME} works correctly") - MESSAGE(STATUS "${MESSAGE}") + set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} PARENT_SCOPE) + endif() +endfunction() + +function(DCMTK_TEST_ENABLE_STL_FEATURE NAME) + string(TOUPPER "${NAME}" FEATURE) + if(ARGN) + set(SOURCEFILE "${ARGN}") + else() + set(SOURCEFILE "${NAME}") + endif() + if(DCMTK_ENABLE_STL_${FEATURE} STREQUAL "INFERRED") + set(DCMTK_ENABLE_STL_${FEATURE} ${DCMTK_ENABLE_STL}) + endif() + set(RESULT 0) + set(TEXT_RESULT "disabled") + if(DCMTK_ENABLE_STL_${FEATURE} STREQUAL "ON") + if(DEFINED HAVE_STL_${FEATURE}_TEST_RESULT) + if(HAVE_STL_${FEATURE}_TEST_RESULT) + set(RESULT 1) + set(TEXT_RESULT "enabled") + endif() + else() + set(MESSAGE "Checking whether STL ${NAME} works correctly") + message(STATUS "${MESSAGE}") DCMTK_TRY_RUN(RUN_RESULT COMPILE_RESULT "${CMAKE_BINARY_DIR}" "${DCMTK_SOURCE_DIR}/config/tests/${SOURCEFILE}.cc") - IF(COMPILE_RESULT AND RUN_RESULT EQUAL 0) - SET(RESULT 1) - SET(TEXT_RESULT "enabled") - MESSAGE(STATUS "${MESSAGE} -- yes") - ELSE() - MESSAGE(STATUS "${MESSAGE} -- no") - ENDIF() - SET(HAVE_STL_${FEATURE}_TEST_RESULT ${RESULT} CACHE INTERNAL "Caches the configuration test result for STL ${NAME}") - ENDIF() - ENDIF() - SET(HAVE_STL_${FEATURE} ${RESULT} CACHE INTERNAL "Set to 1 if the compiler/OS provides a working STL ${NAME} implementation.") - MESSAGE(STATUS "Info: STL ${NAME} support ${TEXT_RESULT}") -ENDFUNCTION(DCMTK_TEST_ENABLE_STL_FEATURE) + if(COMPILE_RESULT AND RUN_RESULT EQUAL 0) + set(RESULT 1) + set(TEXT_RESULT "enabled") + message(STATUS "${MESSAGE} -- yes") + else() + message(STATUS "${MESSAGE} -- no") + endif() + set(HAVE_STL_${FEATURE}_TEST_RESULT ${RESULT} CACHE INTERNAL "Caches the configuration test result for STL ${NAME}") + endif() + endif() + set(HAVE_STL_${FEATURE} ${RESULT} CACHE INTERNAL "Set to 1 if the compiler/OS provides a working STL ${NAME} implementation.") + message(STATUS "Info: STL ${NAME} support ${TEXT_RESULT}") +endfunction() DCMTK_TEST_ENABLE_CXX11() DCMTK_TEST_ENABLE_STL_FEATURE("vector") @@ -1357,6 +1357,6 @@ DCMTK_TEST_ENABLE_STL_FEATURE("type_traits" "ttraits") DCMTK_TEST_ENABLE_STL_FEATURE("tuple") DCMTK_TEST_ENABLE_STL_FEATURE("system_error" "syserr") -IF(CMAKE_CROSSCOMPILING) - SET(DCMTK_CROSS_COMPILING ${CMAKE_CROSSCOMPILING}) -ENDIF(CMAKE_CROSSCOMPILING) +if(CMAKE_CROSSCOMPILING) + set(DCMTK_CROSS_COMPILING ${CMAKE_CROSSCOMPILING}) +endif() diff --git a/CMake/dcmtkAfterModules.cmake b/CMake/dcmtkAfterModules.cmake index feeb096bc4..480ce4f563 100644 --- a/CMake/dcmtkAfterModules.cmake +++ b/CMake/dcmtkAfterModules.cmake @@ -1,27 +1,27 @@ # Finish the setup. This should be run after all modules. -IF(BUILD_SINGLE_SHARED_LIBRARY) +if(BUILD_SINGLE_SHARED_LIBRARY) # Collect the object files of all libraries in all modules. # The variable ${DCMTK_ALL_LIBRARIES} is set by DCMTK_ADD_LIBRARY(). - SET(LIBS) - FOREACH(LIB ${DCMTK_ALL_LIBRARIES}) - SET(LIBS ${LIBS} $) - ENDFOREACH(LIB) + set(LIBS) + foreach(LIB ${DCMTK_ALL_LIBRARIES}) + set(LIBS ${LIBS} $) + endforeach() # Build a single "everything-library". # The library dependencies are collected by DCMTK_TARGET_LINK_LIBRARIES(). - ADD_LIBRARY(dcmtk SHARED ${LIBS}) - TARGET_LINK_LIBRARIES(dcmtk ${DCMTK_LIBRARY_DEPENDENCIES}) - SET_TARGET_PROPERTIES(dcmtk PROPERTIES ${DCMTK_LIBRARY_PROPERTIES}) + add_library(dcmtk SHARED ${LIBS}) + target_link_libraries(dcmtk ${DCMTK_LIBRARY_DEPENDENCIES}) + set_target_properties(dcmtk PROPERTIES ${DCMTK_LIBRARY_PROPERTIES}) # Export target for build tree - SET_PROPERTY(GLOBAL APPEND PROPERTY DCMTK_LIBRARY_TARGETS dcmtk) + set_property(GLOBAL APPEND PROPERTY DCMTK_LIBRARY_TARGETS dcmtk) # Declare installation files. Also export libs and executables to DCMTKTargets.cmake. - INSTALL(TARGETS dcmtk + install(TARGETS dcmtk EXPORT DCMTKTargets COMPONENT lib RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}") -ENDIF(BUILD_SINGLE_SHARED_LIBRARY) +endif() diff --git a/CMake/dcmtkMacros.cmake b/CMake/dcmtkMacros.cmake index 543a8e3eb4..db0cd51b25 100644 --- a/CMake/dcmtkMacros.cmake +++ b/CMake/dcmtkMacros.cmake @@ -4,45 +4,45 @@ # DCMTK_ADD_TESTS - function which registers all tests for a module # MODULE - name of the module that we are called for # -FUNCTION(DCMTK_ADD_TESTS MODULE) - IF(BUILD_APPS AND DCMTK_RUN_CTEST_SCRIPT) - SET(TEST_EXECUTABLE "$") - IF(CMAKE_CROSSCOMPILING) - IF(WIN32) +function(DCMTK_ADD_TESTS MODULE) + if(BUILD_APPS AND DCMTK_RUN_CTEST_SCRIPT) + set(TEST_EXECUTABLE "$") + if(CMAKE_CROSSCOMPILING) + if(WIN32) WINE_COMMAND(TEST_COMMAND "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${MODULE}_tests${CMAKE_EXECUTABLE_SUFFIX}") - STRING(REPLACE "\\" "\\\\" TEST_COMMAND "${TEST_COMMAND}") - ELSEIF(ANDROID) - SET(TEST_COMMAND "${ANDROID_TEMPORARY_FILES_LOCATION}/${MODULE}_tests") - ELSE() + string(REPLACE "\\" "\\\\" TEST_COMMAND "${TEST_COMMAND}") + elseif(ANDROID) + set(TEST_COMMAND "${ANDROID_TEMPORARY_FILES_LOCATION}/${MODULE}_tests") + else() # not reachable, handled by not defining DCMTK_RUN_CTEST_SCRIPT - ENDIF() - ELSE() - SET(TEST_COMMAND "${TEST_EXECUTABLE}") - ENDIF() - LIST(APPEND DCMTK_TEST_EXECUTABLES "${TEST_EXECUTABLE}") - LIST(REMOVE_DUPLICATES DCMTK_TEST_EXECUTABLES) - SET(DCMTK_TEST_EXECUTABLES ${DCMTK_TEST_EXECUTABLES} CACHE INTERNAL "List of executables needed to run the unit tests") - FILE(STRINGS tests.cc AVAIL_TESTS REGEX "OFTEST_REGISTER\\([^)]*\\)") - FOREACH(TEST_LINE ${AVAIL_TESTS}) + endif() + else() + set(TEST_COMMAND "${TEST_EXECUTABLE}") + endif() + list(APPEND DCMTK_TEST_EXECUTABLES "${TEST_EXECUTABLE}") + list(REMOVE_DUPLICATES DCMTK_TEST_EXECUTABLES) + set(DCMTK_TEST_EXECUTABLES ${DCMTK_TEST_EXECUTABLES} CACHE INTERNAL "List of executables needed to run the unit tests") + file(STRINGS tests.cc AVAIL_TESTS REGEX "OFTEST_REGISTER\\([^)]*\\)") + foreach(TEST_LINE ${AVAIL_TESTS}) # TODO: How can we parse tests.cc in a saner way? - STRING(REGEX MATCH "OFTEST_REGISTER\\([^)]*" TEST "${TEST_LINE}") - STRING(REPLACE "OFTEST_REGISTER(" "" TEST ${TEST}) + string(REGEX MATCH "OFTEST_REGISTER\\([^)]*" TEST "${TEST_LINE}") + string(REPLACE "OFTEST_REGISTER(" "" TEST ${TEST}) # This assumes that test names are globally unique - ADD_TEST(NAME "${TEST}" COMMAND "${CMAKE_COMMAND}" "-DDCMTK_CTEST_TESTCASE_COMMAND=${TEST_COMMAND}" "-DDCMTK_CTEST_TEST_NAME=${TEST}" "-P" "${DCMTK_RUN_CTEST_SCRIPT}") - SET_PROPERTY(TEST "${TEST}" PROPERTY LABELS "${MODULE}") - IF(CMAKE_VERSION VERSION_LESS 3.0.0) + add_test(NAME "${TEST}" COMMAND "${CMAKE_COMMAND}" "-DDCMTK_CTEST_TESTCASE_COMMAND=${TEST_COMMAND}" "-DDCMTK_CTEST_TEST_NAME=${TEST}" "-P" "${DCMTK_RUN_CTEST_SCRIPT}") + set_property(TEST "${TEST}" PROPERTY LABELS "${MODULE}") + if(CMAKE_VERSION VERSION_LESS 3.0.0) # CMake versions prior 3 seemingly don't understand $ within a test's REQUIRED_FILES property - SET_PROPERTY(TEST "${TEST}" PROPERTY REQUIRED_FILES "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${MODULE}_tests${CMAKE_EXECUTABLE_SUFFIX}") - ELSE() - SET_PROPERTY(TEST "${TEST}" PROPERTY REQUIRED_FILES "${TEST_EXECUTABLE}") - ENDIF() - ENDFOREACH(TEST_LINE) - ADD_CUSTOM_TARGET("${MODULE}-test-exhaustive" + set_property(TEST "${TEST}" PROPERTY REQUIRED_FILES "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${MODULE}_tests${CMAKE_EXECUTABLE_SUFFIX}") + else() + set_property(TEST "${TEST}" PROPERTY REQUIRED_FILES "${TEST_EXECUTABLE}") + endif() + endforeach() + add_custom_target("${MODULE}-test-exhaustive" COMMAND "${CMAKE_COMMAND}" "-DCONFIG=${DCMTK_CONFIG_GENERATOR_EXPRESSION}" "-P" "${DCMTK_SOURCE_DIR}/CMake/CTest/dcmtkCTestRunExhaustive.cmake" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" ) - ENDIF(BUILD_APPS AND DCMTK_RUN_CTEST_SCRIPT) -ENDFUNCTION(DCMTK_ADD_TESTS) + endif() +endfunction() # # Setup an executable @@ -50,25 +50,25 @@ ENDFUNCTION(DCMTK_ADD_TESTS) # DCMTK_ADD_EXECUTABLE - macro which adds the needed setup for an executable # PROGRAM - name of the executable that we are called for # -MACRO(DCMTK_ADD_EXECUTABLE PROGRAM) - IF(BUILD_APPS) - ADD_EXECUTABLE(${PROGRAM} ${ARGN}) +macro(DCMTK_ADD_EXECUTABLE PROGRAM) + if(BUILD_APPS) + add_executable(${PROGRAM} ${ARGN}) # Make wildcard arguments work - IF(WIN32 AND NOT MINGW) - SET_TARGET_PROPERTIES(${PROGRAM} PROPERTIES LINK_FLAGS ${WIN32_STD_OBJECTS}) - ENDIF(WIN32 AND NOT MINGW) + if(WIN32 AND NOT MINGW) + set_target_properties(${PROGRAM} PROPERTIES LINK_FLAGS ${WIN32_STD_OBJECTS}) + endif() # Collect executable as part of global DCMTK_EXECUTABLE_TARGETS property - SET_PROPERTY(GLOBAL APPEND PROPERTY DCMTK_EXECUTABLE_TARGETS ${PROGRAM}) + set_property(GLOBAL APPEND PROPERTY DCMTK_EXECUTABLE_TARGETS ${PROGRAM}) # declare installation files, also export DCMTKTargets.cmake - INSTALL(TARGETS ${PROGRAM} + install(TARGETS ${PROGRAM} EXPORT DCMTKTargets COMPONENT bin DESTINATION ${CMAKE_INSTALL_BINDIR}) - ENDIF(BUILD_APPS) -ENDMACRO(DCMTK_ADD_EXECUTABLE) + endif() +endmacro() # # Setup a library @@ -77,31 +77,31 @@ ENDMACRO(DCMTK_ADD_EXECUTABLE) # LIBRARY - name of the library that we are called for # extra arguments - names of the library's source files # -MACRO(DCMTK_ADD_LIBRARY LIBRARY) +macro(DCMTK_ADD_LIBRARY LIBRARY) # Actually add the library first - ADD_LIBRARY(${LIBRARY}${DCMTK_LIBRARY_SUFFIX} ${DCMTK_LIBRARY_TYPE} ${ARGN}) - SET(DCMTK_ALL_LIBRARIES ${DCMTK_ALL_LIBRARIES} ${LIBRARY}${DCMTK_LIBRARY_SUFFIX} CACHE INTERNAL "List of all libraries in the DCMTK.") + add_library(${LIBRARY}${DCMTK_LIBRARY_SUFFIX} ${DCMTK_LIBRARY_TYPE} ${ARGN}) + set(DCMTK_ALL_LIBRARIES ${DCMTK_ALL_LIBRARIES} ${LIBRARY}${DCMTK_LIBRARY_SUFFIX} CACHE INTERNAL "List of all libraries in the DCMTK.") # set proper version information for shared library - IF(BUILD_SHARED_LIBS AND NOT BUILD_SINGLE_SHARED_LIBRARY) - SET_TARGET_PROPERTIES(${LIBRARY}${DCMTK_LIBRARY_SUFFIX} PROPERTIES ${DCMTK_LIBRARY_PROPERTIES}) - ELSE(BUILD_SHARED_LIBS AND NOT BUILD_SINGLE_SHARED_LIBRARY) + if(BUILD_SHARED_LIBS AND NOT BUILD_SINGLE_SHARED_LIBRARY) + set_target_properties(${LIBRARY}${DCMTK_LIBRARY_SUFFIX} PROPERTIES ${DCMTK_LIBRARY_PROPERTIES}) + else() # define the foo_EXPORTS-macro even when we are not building ("normal") shared libs - SET_TARGET_PROPERTIES(${LIBRARY}${DCMTK_LIBRARY_SUFFIX} PROPERTIES COMPILE_DEFINITIONS "${LIBRARY}_EXPORTS") - ENDIF(BUILD_SHARED_LIBS AND NOT BUILD_SINGLE_SHARED_LIBRARY) + set_target_properties(${LIBRARY}${DCMTK_LIBRARY_SUFFIX} PROPERTIES COMPILE_DEFINITIONS "${LIBRARY}_EXPORTS") + endif() - IF(NOT BUILD_SINGLE_SHARED_LIBRARY) + if(NOT BUILD_SINGLE_SHARED_LIBRARY) # Remember export target for writing it to build tree later - SET_PROPERTY(GLOBAL APPEND PROPERTY DCMTK_LIBRARY_TARGETS ${LIBRARY}${DCMTK_LIBRARY_SUFFIX}) + set_property(GLOBAL APPEND PROPERTY DCMTK_LIBRARY_TARGETS ${LIBRARY}${DCMTK_LIBRARY_SUFFIX}) # Declare installation files - INSTALL(TARGETS ${LIBRARY}${DCMTK_LIBRARY_SUFFIX} + install(TARGETS ${LIBRARY}${DCMTK_LIBRARY_SUFFIX} EXPORT DCMTKTargets RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib) - ENDIF(NOT BUILD_SINGLE_SHARED_LIBRARY) -ENDMACRO(DCMTK_ADD_LIBRARY) + endif() +endmacro() # # Specify a library's dependencies @@ -110,11 +110,11 @@ ENDMACRO(DCMTK_ADD_LIBRARY) # LIBRARY - name of the library that we are called for # extra arguments - names of the library's dependencies # -MACRO(DCMTK_TARGET_LINK_LIBRARIES LIBRARY) - SET(DCMTK_LIBRARY_DEPENDENCIES ${DCMTK_LIBRARY_DEPENDENCIES} ${ARGN} CACHE INTERNAL "Dependencies of the DCMTK libraries.") +macro(DCMTK_TARGET_LINK_LIBRARIES LIBRARY) + set(DCMTK_LIBRARY_DEPENDENCIES ${DCMTK_LIBRARY_DEPENDENCIES} ${ARGN} CACHE INTERNAL "Dependencies of the DCMTK libraries.") # The name of this macro doesn't match, but it does just what we need here DCMTK_TARGET_LINK_MODULES(${LIBRARY} ${ARGN}) -ENDMACRO(DCMTK_TARGET_LINK_LIBRARIES) +endmacro() # # Link a target against other DCMTK modules @@ -123,52 +123,52 @@ ENDMACRO(DCMTK_TARGET_LINK_LIBRARIES) # TARGET - name of the target that we are called for # extra arguments - names of the modules that should be added # -MACRO(DCMTK_TARGET_LINK_MODULES TARGET) +macro(DCMTK_TARGET_LINK_MODULES TARGET) # This macro is called for libraries and apps. Thus, we need some magic. - # 1. During "normal builds", always call TARGET_LINK_LIBRARIES() + # 1. During "normal builds", always call target_link_libraries() # 2. When BUILD_SINGLE_SHARED_LIBRARY, never call it, because neither the # libraries nor the apps really exist in this mode # 3. When "just" BUILD_APPS is disabled, only call it for libs, not for apps # These rules boil down to: If CMake knows the target (this handles all # cases for apps) and we aren't building a single library (case 2) - IF(TARGET ${TARGET} AND NOT BUILD_SINGLE_SHARED_LIBRARY) - TARGET_LINK_LIBRARIES(${TARGET} ${ARGN}) - ENDIF(TARGET ${TARGET} AND NOT BUILD_SINGLE_SHARED_LIBRARY) -ENDMACRO(DCMTK_TARGET_LINK_MODULES TARGET) + if(TARGET ${TARGET} AND NOT BUILD_SINGLE_SHARED_LIBRARY) + target_link_libraries(${TARGET} ${ARGN}) + endif() +endmacro() # This is an ugly hack to simulate global variables -SET(DCMTK_ALL_LIBRARIES CACHE INTERNAL "List of all libraries in the DCMTK.") -SET(DCMTK_LIBRARY_DEPENDENCIES CACHE INTERNAL "Dependencies of the DCMTK libraries.") +set(DCMTK_ALL_LIBRARIES CACHE INTERNAL "List of all libraries in the DCMTK.") +set(DCMTK_LIBRARY_DEPENDENCIES CACHE INTERNAL "Dependencies of the DCMTK libraries.") # Failsafe implementation of UNSET for old CMake versions -IF(CMAKE_VERSION VERSION_LESS 2.6.3) - MACRO(DCMTK_UNSET VAR) - SET(${VAR}) - ENDMACRO(DCMTK_UNSET) -ELSE(CMAKE_VERSION VERSION_LESS 2.6.3) - MACRO(DCMTK_UNSET VAR) - UNSET(${VAR}) - ENDMACRO(DCMTK_UNSET) -ENDIF(CMAKE_VERSION VERSION_LESS 2.6.3) +if(CMAKE_VERSION VERSION_LESS 2.6.3) + macro(DCMTK_UNSET VAR) + set(${VAR}) + endmacro() +else() + macro(DCMTK_UNSET VAR) + unset(${VAR}) + endmacro() +endif() -# Failsafe implementation of UNSET(... CACHE) for old CMake versions -IF(CMAKE_VERSION VERSION_LESS 2.6.3) - MACRO(DCMTK_UNSET_CACHE VAR) - SET(${VAR} CACHE INTERNAL "") - ENDMACRO(DCMTK_UNSET_CACHE) -ELSE(CMAKE_VERSION VERSION_LESS 2.6.3) - MACRO(DCMTK_UNSET_CACHE VAR) - UNSET(${VAR} CACHE) - ENDMACRO(DCMTK_UNSET_CACHE) -ENDIF(CMAKE_VERSION VERSION_LESS 2.6.3) +# Failsafe implementation of unset(... CACHE) for old CMake versions +if(CMAKE_VERSION VERSION_LESS 2.6.3) + macro(DCMTK_UNSET_CACHE VAR) + set(${VAR} CACHE INTERNAL "") + endmacro() +else() + macro(DCMTK_UNSET_CACHE VAR) + unset(${VAR} CACHE) + endmacro() +endif() -# Failsafe implementation of UNSET(... PARENT_SCOPE) for old CMake versions -IF(CMAKE_VERSION VERSION_LESS 3.0) - MACRO(DCMTK_UNSET_PARENT_SCOPE VAR) - SET(${VAR} PARENT_SCOPE) - ENDMACRO(DCMTK_UNSET_PARENT_SCOPE) -ELSE(CMAKE_VERSION VERSION_LESS 3.0) - MACRO(DCMTK_UNSET_PARENT_SCOPE VAR) - UNSET(${VAR} PARENT_SCOPE) - ENDMACRO(DCMTK_UNSET_PARENT_SCOPE) -ENDIF(CMAKE_VERSION VERSION_LESS 3.0) +# Failsafe implementation of unset(... PARENT_SCOPE) for old CMake versions +if(CMAKE_VERSION VERSION_LESS 3.0) + macro(DCMTK_UNSET_PARENT_SCOPE VAR) + set(${VAR} PARENT_SCOPE) + endmacro() +else() + macro(DCMTK_UNSET_PARENT_SCOPE VAR) + unset(${VAR} PARENT_SCOPE) + endmacro() +endif() diff --git a/CMake/dcmtkPrepare.cmake b/CMake/dcmtkPrepare.cmake index 25e0587fa2..345ef6de5a 100644 --- a/CMake/dcmtkPrepare.cmake +++ b/CMake/dcmtkPrepare.cmake @@ -2,15 +2,15 @@ # This should be run before the individual modules are created. # This file should only run once -IF(DEFINED DCMTK_CONFIGURATION_DONE) - RETURN() -ENDIF(DEFINED DCMTK_CONFIGURATION_DONE) -SET(DCMTK_CONFIGURATION_DONE true) +if(DEFINED DCMTK_CONFIGURATION_DONE) + return() +endif() +set(DCMTK_CONFIGURATION_DONE true) # Minimum CMake version required -IF(CMAKE_BACKWARDS_COMPATIBILITY GREATER 3.10.2) - SET(CMAKE_BACKWARDS_COMPATIBILITY 3.10.2 CACHE STRING "Latest version of CMake when this project was released." FORCE) -ENDIF(CMAKE_BACKWARDS_COMPATIBILITY GREATER 3.10.2) +if(CMAKE_BACKWARDS_COMPATIBILITY GREATER 3.10.2) + set(CMAKE_BACKWARDS_COMPATIBILITY 3.10.2 CACHE STRING "Latest version of CMake when this project was released." FORCE) +endif() # CMAKE_BUILD_TYPE is set to value "Release" if none is specified by the # selected build file generator. For those generators that support multiple @@ -25,85 +25,85 @@ ENDIF(CMAKE_BACKWARDS_COMPATIBILITY GREATER 3.10.2) # on the command line. This may be useful if the compiler flags should be # controlled manually (e.g. as defined in environment variables like CXXFLAGS) # and no CMake defaults related to the selected configuration type kick in. -IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - MESSAGE(STATUS "Setting build type to 'Release' as none was specified.") - SET(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to 'Release' as none was specified.") + set(CMAKE_BUILD_TYPE Release 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" "MinSizeRel" "RelWithDebInfo") -ENDIF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +endif() # Basic version information # (Starting with version 3.5.5, an odd number at the last position indicates # a development snapshot and an even number indicates an official release.) -SET(DCMTK_MAJOR_VERSION 3) -SET(DCMTK_MINOR_VERSION 6) -SET(DCMTK_BUILD_VERSION 3) +set(DCMTK_MAJOR_VERSION 3) +set(DCMTK_MINOR_VERSION 6) +set(DCMTK_BUILD_VERSION 3) # The ABI is not guaranteed to be stable between different snapshots/releases, # so this particular version number is increased for each snapshot or release. -SET(DCMTK_ABI_VERSION 13) +set(DCMTK_ABI_VERSION 13) # Package "release" settings (some are currently unused and, therefore, disabled) -SET(DCMTK_PACKAGE_NAME "dcmtk") -SET(DCMTK_PACKAGE_DATE "DEV") -SET(DCMTK_PACKAGE_VERSION "${DCMTK_MAJOR_VERSION}.${DCMTK_MINOR_VERSION}.${DCMTK_BUILD_VERSION}") -SET(DCMTK_PACKAGE_VERSION_NUMBER ${DCMTK_MAJOR_VERSION}${DCMTK_MINOR_VERSION}${DCMTK_BUILD_VERSION}) -SET(DCMTK_PACKAGE_VERSION_SUFFIX "+") -#SET(DCMTK_PACKAGE_TARNAME "dcmtk-${DCMTK_PACKAGE_VERSION}") -#SET(DCMTK_PACKAGE_STRING "dcmtk ${DCMTK_PACKAGE_VERSION}") -#SET(DCMTK_PACKAGE_BUGREPORT "bugs@dcmtk.org") -#SET(DCMTK_PACKAGE_URL "http://www.dcmtk.org/") +set(DCMTK_PACKAGE_NAME "dcmtk") +set(DCMTK_PACKAGE_DATE "DEV") +set(DCMTK_PACKAGE_VERSION "${DCMTK_MAJOR_VERSION}.${DCMTK_MINOR_VERSION}.${DCMTK_BUILD_VERSION}") +set(DCMTK_PACKAGE_VERSION_NUMBER ${DCMTK_MAJOR_VERSION}${DCMTK_MINOR_VERSION}${DCMTK_BUILD_VERSION}) +set(DCMTK_PACKAGE_VERSION_SUFFIX "+") +#set(DCMTK_PACKAGE_TARNAME "dcmtk-${DCMTK_PACKAGE_VERSION}") +#set(DCMTK_PACKAGE_STRING "dcmtk ${DCMTK_PACKAGE_VERSION}") +#set(DCMTK_PACKAGE_BUGREPORT "bugs@dcmtk.org") +#set(DCMTK_PACKAGE_URL "http://www.dcmtk.org/") # Shared library version information -SET(DCMTK_LIBRARY_PROPERTIES VERSION "${DCMTK_PACKAGE_VERSION}" SOVERSION "${DCMTK_ABI_VERSION}") +set(DCMTK_LIBRARY_PROPERTIES VERSION "${DCMTK_PACKAGE_VERSION}" SOVERSION "${DCMTK_ABI_VERSION}") # General build options and settings -OPTION(BUILD_APPS "Build command line applications and test programs." ON) -OPTION(BUILD_SHARED_LIBS "Build with shared libraries." OFF) -OPTION(BUILD_SINGLE_SHARED_LIBRARY "Build a single DCMTK library." OFF) -MARK_AS_ADVANCED(BUILD_SINGLE_SHARED_LIBRARY) -SET(CMAKE_DEBUG_POSTFIX "" CACHE STRING "Library postfix for debug builds. Usually left blank.") +option(BUILD_APPS "Build command line applications and test programs." ON) +option(BUILD_SHARED_LIBS "Build with shared libraries." OFF) +option(BUILD_SINGLE_SHARED_LIBRARY "Build a single DCMTK library." OFF) +mark_as_advanced(BUILD_SINGLE_SHARED_LIBRARY) +set(CMAKE_DEBUG_POSTFIX "" CACHE STRING "Library postfix for debug builds. Usually left blank.") # add our CMake modules to the module path, but prefer the ones from CMake. -LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_ROOT}/Modules" "${CMAKE_CURRENT_SOURCE_DIR}/${DCMTK_CMAKE_INCLUDE}/CMake/") +list(APPEND CMAKE_MODULE_PATH "${CMAKE_ROOT}/Modules" "${CMAKE_CURRENT_SOURCE_DIR}/${DCMTK_CMAKE_INCLUDE}/CMake/") # newer CMake versions will warn if a module exists in its and the project's module paths, which is now always # the case since above line adds CMake's module path to the project's one. It, therefore, doesn't matter whether # we set the policy to OLD or NEW, since in both cases CMake's own module will be preferred. We just set # the policy to silence the warning. -IF(POLICY CMP0017) - CMAKE_POLICY(SET CMP0017 NEW) -ENDIF() -IF(BUILD_SINGLE_SHARED_LIBRARY) +if(POLICY CMP0017) + cmake_policy(SET CMP0017 NEW) +endif() +if(BUILD_SINGLE_SHARED_LIBRARY) # When we are building a single shared lib, we are building shared libs :-) - SET(BUILD_SHARED_LIBS ON CACHE BOOL "" FORCE) -ENDIF(BUILD_SINGLE_SHARED_LIBRARY) + set(BUILD_SHARED_LIBS ON CACHE BOOL "" FORCE) +endif() # DCMTK build options -OPTION(DCMTK_WITH_TIFF "Configure DCMTK with support for TIFF." ON) -OPTION(DCMTK_WITH_PNG "Configure DCMTK with support for PNG." ON) -OPTION(DCMTK_WITH_XML "Configure DCMTK with support for XML." ON) -OPTION(DCMTK_WITH_ZLIB "Configure DCMTK with support for ZLIB." ON) -OPTION(DCMTK_WITH_OPENSSL "Configure DCMTK with support for OPENSSL." ON) -OPTION(DCMTK_WITH_SNDFILE "Configure DCMTK with support for SNDFILE." ON) -OPTION(DCMTK_WITH_ICONV "Configure DCMTK with support for ICONV." ON) -OPTION(DCMTK_WITH_ICU "Configure DCMTK with support for ICU." ON) -IF(NOT WIN32) - OPTION(DCMTK_WITH_WRAP "Configure DCMTK with support for WRAP." ON) -ENDIF(NOT WIN32) -OPTION(DCMTK_ENABLE_PRIVATE_TAGS "Configure DCMTK with support for DICOM private tags coming with DCMTK." OFF) -OPTION(DCMTK_WITH_THREADS "Configure DCMTK with support for multi-threading." ON) -OPTION(DCMTK_WITH_DOXYGEN "Build API documentation with DOXYGEN." ON) -OPTION(DCMTK_GENERATE_DOXYGEN_TAGFILE "Generate a tag file with DOXYGEN." OFF) -OPTION(DCMTK_WIDE_CHAR_FILE_IO_FUNCTIONS "Build with wide char file I/O functions." OFF) -OPTION(DCMTK_WIDE_CHAR_MAIN_FUNCTION "Build command line tools with wide char main function." OFF) -OPTION(DCMTK_ENABLE_STL "Enable use of native STL classes and algorithms instead of DCMTK's own implementations." OFF) -OPTION(DCMTK_ENABLE_CXX11 "Enable use of native C++11 features (eg. move semantics)." OFF) - -MACRO(DCMTK_INFERABLE_OPTION OPTION DESCRIPTION) - SET("${OPTION}" INFERRED CACHE STRING "${DESCRIPTION}") - SET_PROPERTY(CACHE "${OPTION}" PROPERTY STRINGS "INFERRED" "ON" "OFF") +option(DCMTK_WITH_TIFF "Configure DCMTK with support for TIFF." ON) +option(DCMTK_WITH_PNG "Configure DCMTK with support for PNG." ON) +option(DCMTK_WITH_XML "Configure DCMTK with support for XML." ON) +option(DCMTK_WITH_ZLIB "Configure DCMTK with support for ZLIB." ON) +option(DCMTK_WITH_OPENSSL "Configure DCMTK with support for OPENSSL." ON) +option(DCMTK_WITH_SNDFILE "Configure DCMTK with support for SNDFILE." ON) +option(DCMTK_WITH_ICONV "Configure DCMTK with support for ICONV." ON) +option(DCMTK_WITH_ICU "Configure DCMTK with support for ICU." ON) +if(NOT WIN32) + option(DCMTK_WITH_WRAP "Configure DCMTK with support for WRAP." ON) +endif() +option(DCMTK_ENABLE_PRIVATE_TAGS "Configure DCMTK with support for DICOM private tags coming with DCMTK." OFF) +option(DCMTK_WITH_THREADS "Configure DCMTK with support for multi-threading." ON) +option(DCMTK_WITH_DOXYGEN "Build API documentation with DOXYGEN." ON) +option(DCMTK_GENERATE_DOXYGEN_TAGFILE "Generate a tag file with DOXYGEN." OFF) +option(DCMTK_WIDE_CHAR_FILE_IO_FUNCTIONS "Build with wide char file I/O functions." OFF) +option(DCMTK_WIDE_CHAR_MAIN_FUNCTION "Build command line tools with wide char main function." OFF) +option(DCMTK_ENABLE_STL "Enable use of native STL classes and algorithms instead of DCMTK's own implementations." OFF) +option(DCMTK_ENABLE_CXX11 "Enable use of native C++11 features (eg. move semantics)." OFF) + +macro(DCMTK_INFERABLE_OPTION OPTION DESCRIPTION) + set("${OPTION}" INFERRED CACHE STRING "${DESCRIPTION}") + set_property(CACHE "${OPTION}" PROPERTY STRINGS "INFERRED" "ON" "OFF") # currently, all inferable options are advanced options - MARK_AS_ADVANCED("${OPTION}") -ENDMACRO(DCMTK_INFERABLE_OPTION) + mark_as_advanced("${OPTION}") +endmacro() DCMTK_INFERABLE_OPTION(DCMTK_ENABLE_STL_VECTOR "Enable use of STL vector.") DCMTK_INFERABLE_OPTION(DCMTK_ENABLE_STL_ALGORITHM "Enable use of STL algorithm.") @@ -121,122 +121,122 @@ DCMTK_INFERABLE_OPTION(DCMTK_ENABLE_STL_SYSTEM_ERROR "Enable use of STL system_e # disabled. Loading of external dictionary via run-time is, per default, # configured the the opposite way since most users won't be interested in using # the external default dictionary if it is already compiled in. -IF(WIN32 OR MINGW) - OPTION(DCMTK_ENABLE_BUILTIN_DICTIONARY "Configure DCMTK with compiled-in data dictionary." ON) - OPTION(DCMTK_ENABLE_EXTERNAL_DICTIONARY "Configure DCMTK to load external dictionary from default path on startup." OFF) -ELSE(WIN32 or MINGW) # built-in dictionary turned off on Unix per default - OPTION(DCMTK_ENABLE_BUILTIN_DICTIONARY "Configure DCMTK with compiled-in data dictionary." OFF) - OPTION(DCMTK_ENABLE_EXTERNAL_DICTIONARY "Configure DCMTK to load external dictionary from default path on startup." ON) -ENDIF(WIN32 OR MINGW) +if(WIN32 OR MINGW) + option(DCMTK_ENABLE_BUILTIN_DICTIONARY "Configure DCMTK with compiled-in data dictionary." ON) + option(DCMTK_ENABLE_EXTERNAL_DICTIONARY "Configure DCMTK to load external dictionary from default path on startup." OFF) +else() # built-in dictionary turned off on Unix per default + option(DCMTK_ENABLE_BUILTIN_DICTIONARY "Configure DCMTK with compiled-in data dictionary." OFF) + option(DCMTK_ENABLE_EXTERNAL_DICTIONARY "Configure DCMTK to load external dictionary from default path on startup." ON) +endif() if (NOT DCMTK_ENABLE_EXTERNAL_DICTIONARY AND NOT DCMTK_ENABLE_BUILTIN_DICTIONARY) - MESSAGE(WARNING "Either external or built-in dictionary should be enabled, otherwise dictionary must be loaded manually on startup!") -ENDIF(NOT DCMTK_ENABLE_EXTERNAL_DICTIONARY AND NOT DCMTK_ENABLE_BUILTIN_DICTIONARY) + message(WARNING "Either external or built-in dictionary should be enabled, otherwise dictionary must be loaded manually on startup!") +endif() # Mark various settings as "advanced" -MARK_AS_ADVANCED(CMAKE_DEBUG_POSTFIX) -MARK_AS_ADVANCED(FORCE EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH) -MARK_AS_ADVANCED(SNDFILE_DIR DCMTK_WITH_SNDFILE) # not yet needed in public DCMTK -MARK_AS_ADVANCED(DCMTK_GENERATE_DOXYGEN_TAGFILE) -IF(NOT WIN32) +mark_as_advanced(CMAKE_DEBUG_POSTFIX) +mark_as_advanced(FORCE EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH) +mark_as_advanced(SNDFILE_DIR DCMTK_WITH_SNDFILE) # not yet needed in public DCMTK +mark_as_advanced(DCMTK_GENERATE_DOXYGEN_TAGFILE) +if(NOT WIN32) # support for wide char file I/O functions is currently Windows-specific - MARK_AS_ADVANCED(DCMTK_WIDE_CHAR_FILE_IO_FUNCTIONS) + mark_as_advanced(DCMTK_WIDE_CHAR_FILE_IO_FUNCTIONS) # support for wide char main function is Windows-specific - MARK_AS_ADVANCED(DCMTK_WIDE_CHAR_MAIN_FUNCTION) -ENDIF(NOT WIN32) + mark_as_advanced(DCMTK_WIDE_CHAR_MAIN_FUNCTION) +endif() -ENABLE_TESTING() +enable_testing() #----------------------------------------------------------------------------- # Include appropriate modules and set required variables for cross compiling #----------------------------------------------------------------------------- -IF(CMAKE_CROSSCOMPILING) - IF(WIN32) - INCLUDE("${DCMTK_CMAKE_INCLUDE}CMake/dcmtkUseWine.cmake") +if(CMAKE_CROSSCOMPILING) + if(WIN32) + include("${DCMTK_CMAKE_INCLUDE}CMake/dcmtkUseWine.cmake") DCMTK_SETUP_WINE() - ELSEIF(ANDROID) - INCLUDE("${DCMTK_CMAKE_INCLUDE}CMake/dcmtkUseAndroidSDK.cmake") + elseif(ANDROID) + include("${DCMTK_CMAKE_INCLUDE}CMake/dcmtkUseAndroidSDK.cmake") # Ensure the configuration variables for the Android device emulator exist in the cache. DCMTK_SETUP_ANDROID_EMULATOR() - ENDIF() -ENDIF(CMAKE_CROSSCOMPILING) + endif() +endif() #----------------------------------------------------------------------------- # Generic utilities used for configuring DCMTK #----------------------------------------------------------------------------- -INCLUDE("${DCMTK_CMAKE_INCLUDE}CMake/dcmtkMacros.cmake") +include("${DCMTK_CMAKE_INCLUDE}CMake/dcmtkMacros.cmake") #----------------------------------------------------------------------------- # Prepare external dependencies for cross compiling # (i.e. start the emulator if required) #----------------------------------------------------------------------------- -IF(CMAKE_CROSSCOMPILING) - UNSET(DCMTK_UNIT_TESTS_UNSUPPORTED_WARN_ONCE CACHE) - IF(ANDROID) - UNSET(DCMTK_TRY_RUN_ANDROID_RUNTIME_INSTALLED CACHE) +if(CMAKE_CROSSCOMPILING) + unset(DCMTK_UNIT_TESTS_UNSUPPORTED_WARN_ONCE CACHE) + if(ANDROID) + unset(DCMTK_TRY_RUN_ANDROID_RUNTIME_INSTALLED CACHE) DCMTK_ANDROID_START_EMULATOR(DCMTK_ANDROID_EMULATOR_INSTANCE) - ENDIF() -ENDIF(CMAKE_CROSSCOMPILING) + endif() +endif() #----------------------------------------------------------------------------- # Installation sub-directories #----------------------------------------------------------------------------- # Set project name variable to package name for GnuInstallDirs -SET(PROJECT_NAME "${DCMTK_PACKAGE_NAME}") +set(PROJECT_NAME "${DCMTK_PACKAGE_NAME}") # Provides CMake cache variables with reasonable defaults to create a GNU style installation # directory structure -INCLUDE(GNUInstallDirs) +include(GNUInstallDirs) # CMake's files (DCMTKTarget.cmake, DCMTKConfigVersion.cmake and DCMTKConfig.cmake) are installed # to different installation paths under Unix- and Windows-based systems -IF(UNIX) - SET(DCMTK_INSTALL_CMKDIR "${CMAKE_INSTALL_LIBDIR}/cmake/dcmtk") -ELSEIF(WIN32) - SET(DCMTK_INSTALL_CMKDIR "cmake") -ENDIF(UNIX) +if(UNIX) + set(DCMTK_INSTALL_CMKDIR "${CMAKE_INSTALL_LIBDIR}/cmake/dcmtk") +elseif(WIN32) + set(DCMTK_INSTALL_CMKDIR "cmake") +endif() #----------------------------------------------------------------------------- # Build directories #----------------------------------------------------------------------------- -SET(DCMTK_BUILD_CMKDIR "${CMAKE_BINARY_DIR}") +set(DCMTK_BUILD_CMKDIR "${CMAKE_BINARY_DIR}") #----------------------------------------------------------------------------- # Start with clean DCMTKTargets.cmake, filled in GenerateCMakeExports.cmake #----------------------------------------------------------------------------- -FILE(WRITE "${DCMTK_BUILD_CMKDIR}/DCMTKTargets.cmake" "") +file(WRITE "${DCMTK_BUILD_CMKDIR}/DCMTKTargets.cmake" "") #----------------------------------------------------------------------------- # Platform-independent settings #----------------------------------------------------------------------------- # pass optional build date to compiler -#SET(DCMTK_BUILD_DATE "\\\"YYYY-MM-DD\\\"") -IF(DCMTK_BUILD_DATE) +#set(DCMTK_BUILD_DATE "\\\"YYYY-MM-DD\\\"") +if(DCMTK_BUILD_DATE) - IF(COMMAND CMAKE_POLICY) + if(COMMAND CMAKE_POLICY) # Works around warnings about escaped quotes in ADD_DEFINITIONS statements - CMAKE_POLICY(SET CMP0005 OLD) - ENDIF(COMMAND CMAKE_POLICY) + cmake_policy(SET CMP0005 OLD) + endif() # Xcode needs one escaping layer more than (as far as we know) everyone else - we gotta go deeper! - IF(CMAKE_GENERATOR MATCHES Xcode) - STRING(REPLACE "\\" "\\\\" DCMTK_BUILD_DATE "${DCMTK_BUILD_DATE}") - ENDIF() - ADD_DEFINITIONS(-DDCMTK_BUILD_DATE=${DCMTK_BUILD_DATE}) -ENDIF(DCMTK_BUILD_DATE) + if(CMAKE_GENERATOR MATCHES Xcode) + string(REPLACE "\\" "\\\\" DCMTK_BUILD_DATE "${DCMTK_BUILD_DATE}") + endif() + add_definitions(-DDCMTK_BUILD_DATE=${DCMTK_BUILD_DATE}) +endif() # make OFString(NULL) safe by default -ADD_DEFINITIONS(-DUSE_NULL_SAFE_OFSTRING) +add_definitions(-DUSE_NULL_SAFE_OFSTRING) # tell the DCMTK that we are building the DCMTK -ADD_DEFINITIONS(-DDCMTK_BUILD_IN_PROGRESS) +add_definitions(-DDCMTK_BUILD_IN_PROGRESS) # build output files in these directories -SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") -SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") -SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") #----------------------------------------------------------------------------- # Platform-specific settings @@ -244,102 +244,102 @@ SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") # set project wide flags for compiler and linker -IF(WIN32) - OPTION(DCMTK_OVERWRITE_WIN32_COMPILER_FLAGS "Overwrite compiler flags with DCMTK's WIN32 package default values." ON) -ELSE(WIN32) - SET(DCMTK_OVERWRITE_WIN32_COMPILER_FLAGS OFF) -ENDIF(WIN32) +if(WIN32) + option(DCMTK_OVERWRITE_WIN32_COMPILER_FLAGS "Overwrite compiler flags with DCMTK's WIN32 package default values." ON) +else() + set(DCMTK_OVERWRITE_WIN32_COMPILER_FLAGS OFF) +endif() -IF(DCMTK_OVERWRITE_WIN32_COMPILER_FLAGS AND NOT BUILD_SHARED_LIBS) +if(DCMTK_OVERWRITE_WIN32_COMPILER_FLAGS AND NOT BUILD_SHARED_LIBS) # settings for Microsoft Visual Studio - IF(CMAKE_GENERATOR MATCHES "Visual Studio .*") + if(CMAKE_GENERATOR MATCHES "Visual Studio .*") # get Visual Studio Version - STRING(REGEX REPLACE "Visual Studio ([0-9]+).*" "\\1" VS_VERSION "${CMAKE_GENERATOR}") + string(REGEX REPLACE "Visual Studio ([0-9]+).*" "\\1" VS_VERSION "${CMAKE_GENERATOR}") # these settings never change even for C or C++ - SET(CMAKE_C_FLAGS_DEBUG "/MTd /Z7 /Od") - SET(CMAKE_C_FLAGS_RELEASE "/DNDEBUG /MT /O2") - SET(CMAKE_C_FLAGS_MINSIZEREL "/DNDEBUG /MT /O2") - SET(CMAKE_C_FLAGS_RELWITHDEBINFO "/DNDEBUG /MTd /Z7 /Od") - SET(CMAKE_CXX_FLAGS_DEBUG "/MTd /Z7 /Od") - SET(CMAKE_CXX_FLAGS_RELEASE "/DNDEBUG /MT /O2") - SET(CMAKE_CXX_FLAGS_MINSIZEREL "/DNDEBUG /MT /O2") - SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/DNDEBUG /MTd /Z7 /Od") + set(CMAKE_C_FLAGS_DEBUG "/MTd /Z7 /Od") + set(CMAKE_C_FLAGS_RELEASE "/DNDEBUG /MT /O2") + set(CMAKE_C_FLAGS_MINSIZEREL "/DNDEBUG /MT /O2") + set(CMAKE_C_FLAGS_RELWITHDEBINFO "/DNDEBUG /MTd /Z7 /Od") + set(CMAKE_CXX_FLAGS_DEBUG "/MTd /Z7 /Od") + set(CMAKE_CXX_FLAGS_RELEASE "/DNDEBUG /MT /O2") + set(CMAKE_CXX_FLAGS_MINSIZEREL "/DNDEBUG /MT /O2") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/DNDEBUG /MTd /Z7 /Od") # specific settings for the various Visual Studio versions - IF(VS_VERSION EQUAL 6) - SET(CMAKE_C_FLAGS "/nologo /W3 /GX /Gy /YX") - SET(CMAKE_CXX_FLAGS "/nologo /W3 /GX /Gy /YX /Zm500") # /Zm500 increments heap size which is needed on some system to compile templates in dcmimgle - ENDIF(VS_VERSION EQUAL 6) - IF(VS_VERSION EQUAL 7) - SET(CMAKE_C_FLAGS "/nologo /W3 /Gy") - SET(CMAKE_CXX_FLAGS "/nologo /W3 /Gy") - ENDIF(VS_VERSION EQUAL 7) - IF(VS_VERSION GREATER 7) - SET(CMAKE_C_FLAGS "/nologo /W3 /Gy /EHsc") - SET(CMAKE_CXX_FLAGS "/nologo /W3 /Gy /EHsc") - ENDIF(VS_VERSION GREATER 7) - ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio .*") + if(VS_VERSION EQUAL 6) + set(CMAKE_C_FLAGS "/nologo /W3 /GX /Gy /YX") + set(CMAKE_CXX_FLAGS "/nologo /W3 /GX /Gy /YX /Zm500") # /Zm500 increments heap size which is needed on some system to compile templates in dcmimgle + endif() + if(VS_VERSION EQUAL 7) + set(CMAKE_C_FLAGS "/nologo /W3 /Gy") + set(CMAKE_CXX_FLAGS "/nologo /W3 /Gy") + endif() + if(VS_VERSION GREATER 7) + set(CMAKE_C_FLAGS "/nologo /W3 /Gy /EHsc") + set(CMAKE_CXX_FLAGS "/nologo /W3 /Gy /EHsc") + endif() + endif() # settings for Borland C++ - IF(CMAKE_GENERATOR MATCHES "Borland Makefiles") + if(CMAKE_GENERATOR MATCHES "Borland Makefiles") # further settings required? not tested for a very long time! - SET(CMAKE_STANDARD_LIBRARIES "import32.lib cw32mt.lib") - ENDIF(CMAKE_GENERATOR MATCHES "Borland Makefiles") + set(CMAKE_STANDARD_LIBRARIES "import32.lib cw32mt.lib") + endif() -ENDIF(DCMTK_OVERWRITE_WIN32_COMPILER_FLAGS AND NOT BUILD_SHARED_LIBS) +endif() -IF(BUILD_SHARED_LIBS) - SET(DCMTK_SHARED ON) - IF(BUILD_SINGLE_SHARED_LIBRARY) +if(BUILD_SHARED_LIBS) + set(DCMTK_SHARED ON) + if(BUILD_SINGLE_SHARED_LIBRARY) # We can't build apps, because there is no way to tell CMake to link apps # against the library. - SET(BUILD_APPS OFF CACHE BOOL "" FORCE) + set(BUILD_APPS OFF CACHE BOOL "" FORCE) # We are building static code that can be used in a shared lib - SET(DCMTK_BUILD_SINGLE_SHARED_LIBRARY ON) + set(DCMTK_BUILD_SINGLE_SHARED_LIBRARY ON) # Make CMake build object libraries. They are just a list of object files # which aren't linked together yet. - SET(DCMTK_LIBRARY_TYPE OBJECT) + set(DCMTK_LIBRARY_TYPE OBJECT) # Static and shared libraries can have dependencies in CMake. Object # libraries cannot. Since CMake saves dependencies in its cache, we have to # make sure that it doesn't get confused when a "normal" library turns into # an object library. Do this via a suffix. - SET(DCMTK_LIBRARY_SUFFIX _obj) + set(DCMTK_LIBRARY_SUFFIX _obj) # This uses object libraries which are new in CMake 2.8.8 - CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) - ENDIF(BUILD_SINGLE_SHARED_LIBRARY) + cmake_minimum_required(VERSION 2.8.8) + endif() - OPTION(USE_COMPILER_HIDDEN_VISIBILITY + option(USE_COMPILER_HIDDEN_VISIBILITY "Use hidden visibility support if available" ON) - MARK_AS_ADVANCED(USE_COMPILER_HIDDEN_VISIBILITY) + mark_as_advanced(USE_COMPILER_HIDDEN_VISIBILITY) - INCLUDE(CheckCXXCompilerFlag) + include(CheckCXXCompilerFlag) CHECK_CXX_COMPILER_FLAG("-fvisibility=hidden" GXX_SUPPORTS_VISIBILITY) # This "NOT WIN32" is needed due to a CMake bug that was fixed in # CMake 2.8.x. CHECK_CXX_COMPILER_FLAG() always says "ok" with MSC. - IF(GXX_SUPPORTS_VISIBILITY AND USE_COMPILER_HIDDEN_VISIBILITY AND NOT WIN32) - SET(HAVE_HIDDEN_VISIBILITY ON) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden") - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") - ELSE(GXX_SUPPORTS_VISIBILITY AND USE_COMPILER_HIDDEN_VISIBILITY AND NOT WIN32) - SET(HAVE_HIDDEN_VISIBILITY) - ENDIF(GXX_SUPPORTS_VISIBILITY AND USE_COMPILER_HIDDEN_VISIBILITY AND NOT WIN32) -ENDIF(BUILD_SHARED_LIBS) - -IF(WIN32) # special handling for Windows systems - - IF(MINGW) + if(GXX_SUPPORTS_VISIBILITY AND USE_COMPILER_HIDDEN_VISIBILITY AND NOT WIN32) + set(HAVE_HIDDEN_VISIBILITY ON) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") + else() + set(HAVE_HIDDEN_VISIBILITY) + endif() +endif() + +if(WIN32) # special handling for Windows systems + + if(MINGW) # Avoid auto-importing warnings on MinGW - SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--enable-auto-import") - ELSE(MINGW) - IF(NOT BORLAND) - IF(NOT CYGWIN) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--enable-auto-import") + else() + if(NOT BORLAND) + if(NOT CYGWIN) # Disable min() and max() macros pre-defined by Microsoft. We define our own # version in oflimits.h and on Windows that could result in name clashes in # Visual Studio. - ADD_DEFINITIONS(-DNOMINMAX) + add_definitions(-DNOMINMAX) # On Visual Studio 8 MS deprecated C. This removes all 1.276E1265 security warnings. - IF(NOT DCMTK_ENABLE_VISUAL_STUDIO_DEPRECATED_C_WARNINGS) - ADD_DEFINITIONS( + if(NOT DCMTK_ENABLE_VISUAL_STUDIO_DEPRECATED_C_WARNINGS) + add_definitions( -D_CRT_FAR_MAPPINGS_NO_DEPRECATE -D_CRT_IS_WCTYPE_NO_DEPRECATE -D_CRT_MANAGED_FP_NO_DEPRECATE @@ -351,85 +351,85 @@ IF(WIN32) # special handling for Windows systems -D_CRT_VCCLRIT_NO_DEPRECATE -D_SCL_SECURE_NO_DEPRECATE ) - ENDIF(NOT DCMTK_ENABLE_VISUAL_STUDIO_DEPRECATED_C_WARNINGS) - ENDIF(NOT CYGWIN) - ENDIF(NOT BORLAND) - ENDIF(MINGW) + endif() + endif() + endif() + endif() -ELSE(WIN32) # ... for non-Windows systems +else() # ... for non-Windows systems # Compiler flags for Mac OS X - IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_DARWIN_C_SOURCE") - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_DARWIN_C_SOURCE") + if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_DARWIN_C_SOURCE") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_DARWIN_C_SOURCE") # Compiler flags for NetBSD - ELSEIF(${CMAKE_SYSTEM_NAME} MATCHES "NetBSD") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_XOPEN_SOURCE_EXTENDED -D_XOPEN_SOURCE=500 -D_NETBSD_SOURCE -D_DEFAULT_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_POSIX_C_SOURCE=199506L") - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_XOPEN_SOURCE_EXTENDED -D_XOPEN_SOURCE=500 -D_NETBSD_SOURCE -D_DEFAULT_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_POSIX_C_SOURCE=199506L") + elseif(${CMAKE_SYSTEM_NAME} MATCHES "NetBSD") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_XOPEN_SOURCE_EXTENDED -D_XOPEN_SOURCE=500 -D_NETBSD_SOURCE -D_DEFAULT_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_POSIX_C_SOURCE=199506L") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_XOPEN_SOURCE_EXTENDED -D_XOPEN_SOURCE=500 -D_NETBSD_SOURCE -D_DEFAULT_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_POSIX_C_SOURCE=199506L") # Solaris, FreeBSD and newer versions of OpenBSD fail with these flags - ELSEIF(NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS" AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" AND (NOT ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD" OR ${CMAKE_SYSTEM_VERSION} VERSION_LESS 4)) + elseif(NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS" AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" AND (NOT ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD" OR ${CMAKE_SYSTEM_VERSION} VERSION_LESS 4)) # Compiler flags for all other non-Windows systems - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_XOPEN_SOURCE_EXTENDED -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_POSIX_C_SOURCE=199506L") - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_XOPEN_SOURCE_EXTENDED -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_POSIX_C_SOURCE=199506L") - ENDIF() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_XOPEN_SOURCE_EXTENDED -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_POSIX_C_SOURCE=199506L") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_XOPEN_SOURCE_EXTENDED -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_POSIX_C_SOURCE=199506L") + endif() - OPTION(DCMTK_FORCE_FPIC_ON_UNIX "Add -fPIC compiler flag on unix 64 bit machines to allow linking from dynamic libraries even if DCMTK is built statically" OFF) - MARK_AS_ADVANCED(DCMTK_FORCE_FPIC_ON_UNIX) + option(DCMTK_FORCE_FPIC_ON_UNIX "Add -fPIC compiler flag on unix 64 bit machines to allow linking from dynamic libraries even if DCMTK is built statically" OFF) + mark_as_advanced(DCMTK_FORCE_FPIC_ON_UNIX) # Setting for IA64 / x86_64 which needs -fPIC compiler flag required for shared library build on these platforms - IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND UNIX AND DCMTK_FORCE_FPIC_ON_UNIX) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") - ENDIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND UNIX AND DCMTK_FORCE_FPIC_ON_UNIX) + if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND UNIX AND DCMTK_FORCE_FPIC_ON_UNIX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") + endif() -ENDIF(WIN32) +endif() # define libraries and object files that must be linked to most Windows applications -IF(WIN32) - SET(WIN32_STD_LIBRARIES iphlpapi ws2_32 netapi32 wsock32) - IF(NOT DEFINED MINGW) +if(WIN32) + set(WIN32_STD_LIBRARIES iphlpapi ws2_32 netapi32 wsock32) + if(NOT DEFINED MINGW) # additional object file needed for wildcard expansion; for wchar_t* support, use 'wsetargv' - SET(WIN32_STD_OBJECTS setargv) - ENDIF(NOT DEFINED MINGW) + set(WIN32_STD_OBJECTS setargv) + endif() # settings for Borland C++ - IF(CMAKE_CXX_COMPILER MATCHES bcc32) + if(CMAKE_CXX_COMPILER MATCHES bcc32) # to be checked: further settings required? - SET(CMAKE_STANDARD_LIBRARIES "import32.lib cw32mt.lib") - ENDIF(CMAKE_CXX_COMPILER MATCHES bcc32) -ENDIF(WIN32) + set(CMAKE_STANDARD_LIBRARIES "import32.lib cw32mt.lib") + endif() +endif() # add definition of "DEBUG" to debug mode (since CMake does not do this automatically) -SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG") -SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG") +set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG") +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG") # determine which flags are required to enable C++11 features (if any) -IF(NOT DEFINED DCMTK_CXX11_FLAGS) - IF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") - SET(DCMTK_CXX11_FLAGS "-std=c++11") - ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - IF(CMAKE_HOST_WIN32) - SET(DCMTK_CXX11_FLAGS "/Qstd=c++11") - ELSE() - SET(DCMTK_CXX11_FLAGS "-std=c++11") - ENDIF() - ELSE() - SET(DCMTK_CXX11_FLAGS "") - ENDIF() - SET(DCMTK_CXX11_FLAGS "${DCMTK_CXX11_FLAGS}" CACHE STRING "The flags to add to CMAKE_CXX_FLAGS for enabling C++11 (if any).") - MARK_AS_ADVANCED(DCMTK_CXX11_FLAGS) -ENDIF(NOT DEFINED DCMTK_CXX11_FLAGS) +if(NOT DEFINED DCMTK_CXX11_FLAGS) + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + set(DCMTK_CXX11_FLAGS "-std=c++11") + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + if(CMAKE_HOST_WIN32) + set(DCMTK_CXX11_FLAGS "/Qstd=c++11") + else() + set(DCMTK_CXX11_FLAGS "-std=c++11") + endif() + else() + set(DCMTK_CXX11_FLAGS "") + endif() + set(DCMTK_CXX11_FLAGS "${DCMTK_CXX11_FLAGS}" CACHE STRING "The flags to add to CMAKE_CXX_FLAGS for enabling C++11 (if any).") + mark_as_advanced(DCMTK_CXX11_FLAGS) +endif() #----------------------------------------------------------------------------- # Third party libraries #----------------------------------------------------------------------------- -INCLUDE(${DCMTK_CMAKE_INCLUDE}CMake/3rdparty.cmake) +include(${DCMTK_CMAKE_INCLUDE}CMake/3rdparty.cmake) #----------------------------------------------------------------------------- # DCMTK libraries #----------------------------------------------------------------------------- -INCLUDE(${DCMTK_CMAKE_INCLUDE}CMake/GenerateDCMTKConfigure.cmake) +include(${DCMTK_CMAKE_INCLUDE}CMake/GenerateDCMTKConfigure.cmake) #----------------------------------------------------------------------------- # Dart configuration (disabled per default) @@ -438,56 +438,56 @@ INCLUDE(${DCMTK_CMAKE_INCLUDE}CMake/GenerateDCMTKConfigure.cmake) # Includes build targets Experimental, Nightly and Continuous which are the standard # groups pre-configured in Dashboard. In CTest these groups are called "Tracks". # -# INCLUDE(${CMAKE_ROOT}/Modules/Dart.cmake) -# IF(BUILD_TESTING) -# ENABLE_TESTING() -# ENDIF(BUILD_TESTING) +# include(${CMAKE_ROOT}/Modules/Dart.cmake) +# if(BUILD_TESTING) +# enable_testing() +# endif() #----------------------------------------------------------------------------- # Thread support #----------------------------------------------------------------------------- # See dcmtk/config/configure.in -IF(WITH_THREADS) - ADD_DEFINITIONS(-D_REENTRANT) - IF(HAVE_PTHREAD_RWLOCK) - IF(APPLE) - ADD_DEFINITIONS(-D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE) - ENDIF(APPLE) - IF("${CMAKE_SYSTEM_NAME}" MATCHES "^IRIX") - ADD_DEFINITIONS(-D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE -D_BSD_COMPAT) - ENDIF("${CMAKE_SYSTEM_NAME}" MATCHES "^IRIX") - ENDIF(HAVE_PTHREAD_RWLOCK) - - IF(HAVE_PTHREAD_H) +if(WITH_THREADS) + add_definitions(-D_REENTRANT) + if(HAVE_PTHREAD_RWLOCK) + if(APPLE) + add_definitions(-D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE) + endif() + if("${CMAKE_SYSTEM_NAME}" MATCHES "^IRIX") + add_definitions(-D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE -D_BSD_COMPAT) + endif() + endif() + + if(HAVE_PTHREAD_H) CHECK_LIBRARY_EXISTS(pthread pthread_key_create "" HAVE_LIBPTHREAD) - IF(HAVE_LIBPTHREAD) - SET(THREAD_LIBS pthread) - ENDIF(HAVE_LIBPTHREAD) + if(HAVE_LIBPTHREAD) + set(THREAD_LIBS pthread) + endif() CHECK_LIBRARY_EXISTS(rt sem_init "" HAVE_LIBRT) - IF(HAVE_LIBRT) - SET(THREAD_LIBS ${THREAD_LIBS} rt) - ENDIF(HAVE_LIBRT) - ENDIF(HAVE_PTHREAD_H) -ENDIF(WITH_THREADS) + if(HAVE_LIBRT) + set(THREAD_LIBS ${THREAD_LIBS} rt) + endif() + endif() +endif() #----------------------------------------------------------------------------- # Test for socket libraries if needed (Solaris) #----------------------------------------------------------------------------- -SET(SOCKET_LIBS) +set(SOCKET_LIBS) -FUNCTION(DCMTK_TEST_SOCKET_LIBRARY NAME SYMBOL) - STRING(TOUPPER "${NAME}" VARNAME) +function(DCMTK_TEST_SOCKET_LIBRARY NAME SYMBOL) + string(TOUPPER "${NAME}" VARNAME) CHECK_LIBRARY_EXISTS("${NAME}" "main" "" "HAVE_LIB${VARNAME}_MAIN") - IF(NOT HAVE_LIB${VARNAME}_MAIN) + if(NOT HAVE_LIB${VARNAME}_MAIN) CHECK_LIBRARY_EXISTS("${NAME}" "${SYMBOL}" "" "HAVE_LIB${VARNAME}") - ENDIF(NOT HAVE_LIB${VARNAME}_MAIN) - IF(HAVE_LIB${VARNAME} OR HAVE_LIB${VARNAME}_MAIN) - LIST(APPEND SOCKET_LIBS "${NAME}") - SET(SOCKET_LIBS "${SOCKET_LIBS}" PARENT_SCOPE) - ENDIF(HAVE_LIB${VARNAME} OR HAVE_LIB${VARNAME}_MAIN) -ENDFUNCTION(DCMTK_TEST_SOCKET_LIBRARY) + endif() + if(HAVE_LIB${VARNAME} OR HAVE_LIB${VARNAME}_MAIN) + list(APPEND SOCKET_LIBS "${NAME}") + set(SOCKET_LIBS "${SOCKET_LIBS}" PARENT_SCOPE) + endif() +endfunction() DCMTK_TEST_SOCKET_LIBRARY(nsl "gethostbyname") DCMTK_TEST_SOCKET_LIBRARY(socket "socket") @@ -496,16 +496,16 @@ DCMTK_TEST_SOCKET_LIBRARY(socket "socket") # Test if SunPro compiler and add features #----------------------------------------------------------------------------- -IF(CMAKE_CXX_COMPILER_ID STREQUAL SunPro) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -features=tmplrefstatic") -ENDIF() +if(CMAKE_CXX_COMPILER_ID STREQUAL SunPro) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -features=tmplrefstatic") +endif() #----------------------------------------------------------------------------- # workaround for using the deprecated generator expression $ # with old CMake versions that do not understand $ #----------------------------------------------------------------------------- -IF(CMAKE_VERSION VERSION_LESS 3.0.0) - SET(DCMTK_CONFIG_GENERATOR_EXPRESSION "$" CACHE INTERNAL "the generator expression to use for retriving the current config") -ELSE() - SET(DCMTK_CONFIG_GENERATOR_EXPRESSION "$" CACHE INTERNAL "the generator expression to use for retriving the current config") -ENDIF() +if(CMAKE_VERSION VERSION_LESS 3.0.0) + set(DCMTK_CONFIG_GENERATOR_EXPRESSION "$" CACHE INTERNAL "the generator expression to use for retriving the current config") +else() + set(DCMTK_CONFIG_GENERATOR_EXPRESSION "$" CACHE INTERNAL "the generator expression to use for retriving the current config") +endif() diff --git a/CMake/dcmtkTryCompile.cmake b/CMake/dcmtkTryCompile.cmake index 0010b0b67f..df5f3b85d7 100644 --- a/CMake/dcmtkTryCompile.cmake +++ b/CMake/dcmtkTryCompile.cmake @@ -5,39 +5,39 @@ # MESSAGE - Description of the thing that we are checking for # SOURCE - Code to compile # -# All extra arguments are passed to TRY_COMPILE(). +# All extra arguments are passed to try_compile(). # -MACRO(DCMTK_TRY_COMPILE VAR MESSAGE SOURCE) - SET(DCMTK_TRY_COMPILE_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx") +macro(DCMTK_TRY_COMPILE VAR MESSAGE SOURCE) + set(DCMTK_TRY_COMPILE_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx") # Do nothing if the variable is already set - IF(NOT DEFINED "${VAR}") - MESSAGE(STATUS "Checking whether ${MESSAGE}") - FILE(WRITE "${DCMTK_TRY_COMPILE_FILE}" "${SOURCE}\n") - IF(DCMTK_TRY_COMPILE_REQUIRED_CMAKE_FLAGS) - SET(DCMTK_TRY_COMPILE_CMAKE_FLAGS CMAKE_FLAGS ${DCMTK_TRY_COMPILE_REQUIRED_CMAKE_FLAGS}) - ELSE() + if(NOT DEFINED "${VAR}") + message(STATUS "Checking whether ${MESSAGE}") + file(WRITE "${DCMTK_TRY_COMPILE_FILE}" "${SOURCE}\n") + if(DCMTK_TRY_COMPILE_REQUIRED_CMAKE_FLAGS) + set(DCMTK_TRY_COMPILE_CMAKE_FLAGS CMAKE_FLAGS ${DCMTK_TRY_COMPILE_REQUIRED_CMAKE_FLAGS}) + else() DCMTK_UNSET(DCMTK_TRY_COMPILE_CMAKE_FLAGS) - ENDIF() - TRY_COMPILE(${VAR} + endif() + try_compile(${VAR} "${CMAKE_BINARY_DIR}" "${DCMTK_TRY_COMPILE_FILE}" ${DCMTK_TRY_COMPILE_CMAKE_FLAGS} OUTPUT_VARIABLE OUTPUT ${ARGN}) - IF(${VAR}) - MESSAGE(STATUS "Checking whether ${MESSAGE} -- yes") - SET(${VAR} 1 CACHE INTERNAL "${MESSAGE}") - FILE(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log" + if(${VAR}) + message(STATUS "Checking whether ${MESSAGE} -- yes") + set(${VAR} 1 CACHE INTERNAL "${MESSAGE}") + file(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log" "${MESSAGE} passed with the following output:\n" "${OUTPUT}\n") - ELSE(${VAR}) - MESSAGE(STATUS "Checking whether ${MESSAGE} -- no") - SET(${VAR} 0 CACHE INTERNAL "${MESSAGE}") - FILE(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log" + else() + message(STATUS "Checking whether ${MESSAGE} -- no") + set(${VAR} 0 CACHE INTERNAL "${MESSAGE}") + file(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log" "${MESSAGE} failed with the following output:\n" "${OUTPUT}\n") - ENDIF(${VAR}) - ENDIF(NOT DEFINED "${VAR}") -ENDMACRO(DCMTK_TRY_COMPILE) + endif() + endif() +endmacro() diff --git a/CMake/dcmtkTryRun.cmake b/CMake/dcmtkTryRun.cmake index 3a425f29de..509fcf6a40 100644 --- a/CMake/dcmtkTryRun.cmake +++ b/CMake/dcmtkTryRun.cmake @@ -1,64 +1,64 @@ # -# Wrapper implementation of TRY_RUN(), with some support for +# Wrapper implementation of try_run(), with some support for # cross-compiling # -# Usage and syntax is equivalent to CMake's TRY_RUN(). +# Usage and syntax is equivalent to CMake's try_run(). # # CMakeParseArguments was introduced in CMake 2.8.3. -# DCMTK_TRY_RUN will revert to CMake's internal TRY_RUN() +# DCMTK_TRY_RUN will revert to CMake's internal try_run() # for versions prior to 2.8.3, as arguments can't be parsed # in that case. This means cross compiling support will be # disabled for CMake versions prior to 2.8.3. -IF(CMAKE_VERSION VERSION_LESS 2.8.3) +if(CMAKE_VERSION VERSION_LESS 2.8.3) -MACRO(DCMTK_TRY_RUN) - TRY_RUN(${ARGN}) -ENDMACRO(DCMTK_TRY_RUN) +macro(DCMTK_TRY_RUN) + try_run(${ARGN}) +endmacro() -ELSE(CMAKE_VERSION VERSION_LESS 2.8.3) +else() -INCLUDE(CMakeParseArguments) +include(CMakeParseArguments) -FUNCTION(DCMTK_TRY_RUN_CROSS RUN_RESULT_VAR COMPILE_RESULT_VAR bindir srcfile) - CMAKE_PARSE_ARGUMENTS(DCMTK_TRY_RUN +function(DCMTK_TRY_RUN_CROSS RUN_RESULT_VAR COMPILE_RESULT_VAR bindir srcfile) + cmake_parse_arguments(DCMTK_TRY_RUN "" "COMPILE_OUTPUT_VARIABLE;RUN_OUTPUT_VARIABLE;OUTPUT_VARIABLE" "CMAKE_FLAGS;COMPILE_DEFINITIONS;ARGS" ${ARGN} ) - GET_FILENAME_COMPONENT(OUTPUT_EXECUTABLE_NAME "${srcfile}" NAME) - SET(OUTPUT_EXECUTABLE_NAME "${OUTPUT_EXECUTABLE_NAME}${CMAKE_EXECUTABLE_SUFFIX}") - SET(OUTPUT_EXECUTABLE "${bindir}/${OUTPUT_EXECUTABLE_NAME}") - SET(TRY_COMPILE_ARGS "${COMPILE_RESULT_VAR}" "${bindir}" "${srcfile}") - IF(DCMTK_TRY_RUN_CMAKE_FLAGS) - LIST(APPEND TRY_COMPILE_ARGS CMAKE_FLAGS ${DCMTK_TRY_RUN_CMAKE_FLAGS} ${DCMTK_TRY_COMPILE_REQUIRED_CMAKE_FLAGS}) - ELSEIF(DCMTK_TRY_COMPILE_REQUIRED_CMAKE_FLAGS) - LIST(APPEND TRY_COMPILE_ARGS CMAKE_FLAGS ${DCMTK_TRY_COMPILE_REQUIRED_CMAKE_FLAGS}) - ENDIF() - IF(DCMTK_TRY_RUN_COMPILE_DEFINITIONS) - LIST(APPEND TRY_COMPILE_ARGS COMPILE_DEFINITIONS ${DCMTK_TRY_RUN_COMPILE_DEFINITIONS}) - ENDIF() - IF(DCMTK_TRY_RUN_COMPILE_OUTPUT_VARIABLE) - LIST(APPEND TRY_COMPILE_ARGS OUTPUT_VARIABLE ${DCMTK_TRY_RUN_COMPILE_OUTPUT_VARIABLE}) - ENDIF() - TRY_COMPILE(${TRY_COMPILE_ARGS} COPY_FILE "${OUTPUT_EXECUTABLE}") - SET("${COMPILE_RESULT_VAR}" ${${COMPILE_RESULT_VAR}} PARENT_SCOPE) - IF(DCMTK_TRY_RUN_COMPILE_OUTPUT_VARIABLE) - SET("${DCMTK_TRY_RUN_COMPILE_OUTPUT_VARIABLE}" ${${DCMTK_TRY_RUN_COMPILE_OUTPUT_VARIABLE}} PARENT_SCOPE) - ENDIF() - IF(${COMPILE_RESULT_VAR}) - IF(WIN32) + get_filename_component(OUTPUT_EXECUTABLE_NAME "${srcfile}" NAME) + set(OUTPUT_EXECUTABLE_NAME "${OUTPUT_EXECUTABLE_NAME}${CMAKE_EXECUTABLE_SUFFIX}") + set(OUTPUT_EXECUTABLE "${bindir}/${OUTPUT_EXECUTABLE_NAME}") + set(TRY_COMPILE_ARGS "${COMPILE_RESULT_VAR}" "${bindir}" "${srcfile}") + if(DCMTK_TRY_RUN_CMAKE_FLAGS) + list(APPEND TRY_COMPILE_ARGS CMAKE_FLAGS ${DCMTK_TRY_RUN_CMAKE_FLAGS} ${DCMTK_TRY_COMPILE_REQUIRED_CMAKE_FLAGS}) + elseif(DCMTK_TRY_COMPILE_REQUIRED_CMAKE_FLAGS) + list(APPEND TRY_COMPILE_ARGS CMAKE_FLAGS ${DCMTK_TRY_COMPILE_REQUIRED_CMAKE_FLAGS}) + endif() + if(DCMTK_TRY_RUN_COMPILE_DEFINITIONS) + list(APPEND TRY_COMPILE_ARGS COMPILE_DEFINITIONS ${DCMTK_TRY_RUN_COMPILE_DEFINITIONS}) + endif() + if(DCMTK_TRY_RUN_COMPILE_OUTPUT_VARIABLE) + list(APPEND TRY_COMPILE_ARGS OUTPUT_VARIABLE ${DCMTK_TRY_RUN_COMPILE_OUTPUT_VARIABLE}) + endif() + try_compile(${TRY_COMPILE_ARGS} COPY_FILE "${OUTPUT_EXECUTABLE}") + set("${COMPILE_RESULT_VAR}" ${${COMPILE_RESULT_VAR}} PARENT_SCOPE) + if(DCMTK_TRY_RUN_COMPILE_OUTPUT_VARIABLE) + set("${DCMTK_TRY_RUN_COMPILE_OUTPUT_VARIABLE}" ${${DCMTK_TRY_RUN_COMPILE_OUTPUT_VARIABLE}} PARENT_SCOPE) + endif() + if(${COMPILE_RESULT_VAR}) + if(WIN32) WINE_COMMAND(CMD "${OUTPUT_EXECUTABLE}" ${DCMTK_TRY_RUN_ARGS}) WINE_DETACHED("${RUN_RESULT_VAR}" "${DCMTK_TRY_RUN_RUN_OUTPUT_VARIABLE}" "${DCMTK_TRY_RUN_RUN_OUTPUT_VARIABLE}" "${WINE_WINE_PROGRAM}" ${CMD}) - ELSEIF(ANDROID) + elseif(ANDROID) DCMTK_ANDROID_WAIT_FOR_EMULATOR(DCMTK_ANDROID_EMULATOR_INSTANCE) - IF(NOT DCMTK_TRY_RUN_ANDROID_RUNTIME_INSTALLED) + if(NOT DCMTK_TRY_RUN_ANDROID_RUNTIME_INSTALLED) DCMTK_ANDROID_FIND_RUNTIME_LIBRARIES(ANDROID_RUNTIME_LIBRARIES) - SET(ANDROID_RUNTIME_LIBRARIES ${ANDROID_RUNTIME_LIBRARIES} CACHE INTERNAL "") + set(ANDROID_RUNTIME_LIBRARIES ${ANDROID_RUNTIME_LIBRARIES} CACHE INTERNAL "") DCMTK_ANDROID_PUSH(DCMTK_ANDROID_EMULATOR_INSTANCE ${ANDROID_RUNTIME_LIBRARIES} DESTINATION "${ANDROID_TEMPORARY_FILES_LOCATION}") - SET(DCMTK_TRY_RUN_ANDROID_RUNTIME_INSTALLED TRUE CACHE INTERNAL "") - ENDIF() + set(DCMTK_TRY_RUN_ANDROID_RUNTIME_INSTALLED TRUE CACHE INTERNAL "") + endif() DCMTK_ANDROID_PUSH(DCMTK_ANDROID_EMULATOR_INSTANCE "${OUTPUT_EXECUTABLE}" DESTINATION "${ANDROID_TEMPORARY_FILES_LOCATION}/${OUTPUT_EXECUTABLE_NAME}") DCMTK_ANDROID_SHELL(DCMTK_ANDROID_EMULATOR_INSTANCE COMMAND chmod 755 "${ANDROID_TEMPORARY_FILES_LOCATION}/${OUTPUT_EXECUTABLE_NAME}" @@ -71,22 +71,22 @@ FUNCTION(DCMTK_TRY_RUN_CROSS RUN_RESULT_VAR COMPILE_RESULT_VAR bindir srcfile) OUTPUT_VARIABLE "${DCMTK_TRY_RUN_RUN_OUTPUT_VARIABLE}" ERROR_VARIABLE "${DCMTK_TRY_RUN_RUN_OUTPUT_VARIABLE}" ) - ELSE() - MESSAGE(WARNING "Emulation for your target platform is not available, please fill in the required configure test results manually.") - TRY_RUN("${RUN_RESULT_VAR}" "${COMPILE_RESULT_VAR}" "${bindir}" "${srcfile}" ${ARGN}) - RETURN() - ENDIF() - SET("${RUN_RESULT_VAR}" ${${RUN_RESULT_VAR}} PARENT_SCOPE) - SET("${DCMTK_TRY_RUN_RUN_OUTPUT_VARIABLE}" ${${DCMTK_TRY_RUN_RUN_OUTPUT_VARIABLE}} PARENT_SCOPE) - ENDIF() -ENDFUNCTION(DCMTK_TRY_RUN_CROSS) + else() + message(WARNING "Emulation for your target platform is not available, please fill in the required configure test results manually.") + try_run("${RUN_RESULT_VAR}" "${COMPILE_RESULT_VAR}" "${bindir}" "${srcfile}" ${ARGN}) + return() + endif() + set("${RUN_RESULT_VAR}" ${${RUN_RESULT_VAR}} PARENT_SCOPE) + set("${DCMTK_TRY_RUN_RUN_OUTPUT_VARIABLE}" ${${DCMTK_TRY_RUN_RUN_OUTPUT_VARIABLE}} PARENT_SCOPE) + endif() +endfunction() -MACRO(DCMTK_TRY_RUN) - IF(CMAKE_CROSSCOMPILING) +macro(DCMTK_TRY_RUN) + if(CMAKE_CROSSCOMPILING) DCMTK_TRY_RUN_CROSS(${ARGN}) - ELSE(CMAKE_CROSSCOMPILING) - TRY_RUN(${ARGN}) - ENDIF(CMAKE_CROSSCOMPILING) -ENDMACRO(DCMTK_TRY_RUN) + else() + try_run(${ARGN}) + endif() +endmacro() -ENDIF(CMAKE_VERSION VERSION_LESS 2.8.3) +endif() diff --git a/CMake/dcmtkUseAndroidSDK.cmake b/CMake/dcmtkUseAndroidSDK.cmake index 57fab9b1a1..dec15b94df 100644 --- a/CMake/dcmtkUseAndroidSDK.cmake +++ b/CMake/dcmtkUseAndroidSDK.cmake @@ -35,7 +35,7 @@ # tools of the NDK (e. g. 'adb') by referring to the # instance with the value of EMULATOR_NAME. -INCLUDE(CMakeParseArguments) +include(CMakeParseArguments) # # 'Unpacks' an Android emulator instance handle object to @@ -50,18 +50,18 @@ INCLUDE(CMakeParseArguments) # is not a valid emulator instance handle. # All additional arguments will be ignored. # -MACRO(DCMTK_ANDROID_GET_OBJECT_PROPERTIES VAR) - LIST(LENGTH ${VAR} ${VAR}_LENGTH) - IF(${VAR}_LENGTH EQUAL 3) - LIST(GET ${VAR} 0 EMULATOR_STATE) - LIST(GET ${VAR} 1 EMULATOR_UUID) - LIST(GET ${VAR} 2 EMULATOR_NAME) - ELSE() - UNSET(EMULATOR_STATE) - UNSET(EMULATOR_UUID) - UNSET(EMULATOR_NAME) - ENDIF() -ENDMACRO(DCMTK_ANDROID_GET_OBJECT_PROPERTIES) +macro(DCMTK_ANDROID_GET_OBJECT_PROPERTIES VAR) + list(LENGTH ${VAR} ${VAR}_LENGTH) + if(${VAR}_LENGTH EQUAL 3) + list(GET ${VAR} 0 EMULATOR_STATE) + list(GET ${VAR} 1 EMULATOR_UUID) + list(GET ${VAR} 2 EMULATOR_NAME) + else() + unset(EMULATOR_STATE) + unset(EMULATOR_UUID) + unset(EMULATOR_NAME) + endif() +endmacro() # # Stores the properties of an emulator instance inside an @@ -73,9 +73,9 @@ ENDMACRO(DCMTK_ANDROID_GET_OBJECT_PROPERTIES) # EMULATOR_NAME - the name to set # All additional arguments will be ignored. # -MACRO(DCMTK_ANDROID_SET_OBJECT_PROPERTIES VAR EMULATOR_STATE EMULATOR_UUID EMULATOR_NAME) - SET(${VAR} "${EMULATOR_STATE}" "${EMULATOR_UUID}" "${EMULATOR_NAME}" CACHE INTERNAL "") -ENDMACRO(DCMTK_ANDROID_SET_OBJECT_PROPERTIES) +macro(DCMTK_ANDROID_SET_OBJECT_PROPERTIES VAR EMULATOR_STATE EMULATOR_UUID EMULATOR_NAME) + set(${VAR} "${EMULATOR_STATE}" "${EMULATOR_UUID}" "${EMULATOR_NAME}" CACHE INTERNAL "") +endmacro() # # Destroys an instance handle object. @@ -83,9 +83,9 @@ ENDMACRO(DCMTK_ANDROID_SET_OBJECT_PROPERTIES) # shall be object destroyed # All additional arguments will be ignored. # -MACRO(DCMTK_ANDROID_DESTROY_OBJECT VAR) - UNSET("${VAR}" CACHE) -ENDMACRO(DCMTK_ANDROID_DESTROY_OBJECT) +macro(DCMTK_ANDROID_DESTROY_OBJECT VAR) + unset("${VAR}" CACHE) +endmacro() # # Tries to detect any required shared objects within the NDK @@ -95,21 +95,21 @@ ENDMACRO(DCMTK_ANDROID_DESTROY_OBJECT) # required (e. g. when they are linked statically). # All additional arguments will be ignored. # -FUNCTION(DCMTK_ANDROID_FIND_RUNTIME_LIBRARIES VAR) - SET(CMAKE_FIND_LIBRARY_SUFFIXES ".so") - FOREACH(DIR ${ANDROID_STL_INCLUDE_DIRS}) - IF(CMAKE_VERSION VERSION_LESS 2.8.11) - GET_FILENAME_COMPONENT(DIR "${DIR}" PATH) - ELSE() - GET_FILENAME_COMPONENT(DIR "${DIR}" DIRECTORY) - ENDIF() - LIST(APPEND ANDROID_STL_LIBRARY_DIRS "${DIR}") - ENDFOREACH() - FIND_LIBRARY(ANDROID_STL_SHARED_OBJECT ${ANDROID_STL} PATHS ${ANDROID_STL_LIBRARY_DIRS} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) - IF(ANDROID_STL_SHARED_OBJECT) - SET("${VAR}" ${ANDROID_STL_SHARED_OBJECT} PARENT_SCOPE) - ENDIF() -ENDFUNCTION(DCMTK_ANDROID_FIND_RUNTIME_LIBRARIES) +function(DCMTK_ANDROID_FIND_RUNTIME_LIBRARIES VAR) + set(CMAKE_FIND_LIBRARY_SUFFIXES ".so") + foreach(DIR ${ANDROID_STL_INCLUDE_DIRS}) + if(CMAKE_VERSION VERSION_LESS 2.8.11) + get_filename_component(DIR "${DIR}" PATH) + else() + get_filename_component(DIR "${DIR}" DIRECTORY) + endif() + list(APPEND ANDROID_STL_LIBRARY_DIRS "${DIR}") + endforeach() + find_library(ANDROID_STL_SHARED_OBJECT ${ANDROID_STL} PATHS ${ANDROID_STL_LIBRARY_DIRS} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) + if(ANDROID_STL_SHARED_OBJECT) + set("${VAR}" ${ANDROID_STL_SHARED_OBJECT} PARENT_SCOPE) + endif() +endfunction() # # Tries to detect the required executables and scripts automatically, @@ -119,38 +119,38 @@ ENDFUNCTION(DCMTK_ANDROID_FIND_RUNTIME_LIBRARIES) # successful. # All arguments will be ignored. # -FUNCTION(DCMTK_SETUP_ANDROID_EMULATOR) - IF(NOT ANDROID_TEMPORARY_FILES_LOCATION) - SET(ANDROID_TEMPORARY_FILES_LOCATION "/cache" CACHE STRING "The path on the Android device that should be used for temporary files") - ENDIF() - IF(NOT ANDROID_SDK_ROOT) - IF(CMAKE_HOST_SYSTEM MATCHES "Windows.*") - FILE(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" ANDROID_SDK_SEARCH_PATHS) - SET(ANDROID_SDK_ROOT "${ANDROID_SDK_SEARCH_PATHS}/android-sdk" CACHE PATH "Location of the Android SDK") - ELSE() - SET(ANDROID_SDK_ROOT "/opt/android-sdk" CACHE PATH "Location of the Android SDK") - ENDIF() - ENDIF() - FIND_PROGRAM(ANDROID_EMULATOR_PROGRAM emulator PATHS ${ANDROID_SDK_ROOT} PATH_SUFFIXES tools NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) - IF(CMAKE_HOST_SYSTEM MATCHES "Windows.*") - FIND_PROGRAM(ANDROID_ANDROID_PROGRAM android.bat PATHS ${ANDROID_SDK_ROOT} PATH_SUFFIXES tools NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) - ELSE() - FIND_PROGRAM(ANDROID_ANDROID_PROGRAM android PATHS ${ANDROID_SDK_ROOT} PATH_SUFFIXES tools NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) - ENDIF() - FIND_PROGRAM(ANDROID_ADB_PROGRAM adb PATHS ${ANDROID_SDK_ROOT} PATH_SUFFIXES platform-tools NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) - IF(NOT ANDROID_EMULATOR_PROGRAM OR NOT ANDROID_ANDROID_PROGRAM OR NOT ANDROID_ADB_PROGRAM) - MESSAGE(FATAL_ERROR +function(DCMTK_SETUP_ANDROID_EMULATOR) + if(NOT ANDROID_TEMPORARY_FILES_LOCATION) + set(ANDROID_TEMPORARY_FILES_LOCATION "/cache" CACHE STRING "The path on the Android device that should be used for temporary files") + endif() + if(NOT ANDROID_SDK_ROOT) + if(CMAKE_HOST_SYSTEM MATCHES "Windows.*") + file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" ANDROID_SDK_SEARCH_PATHS) + set(ANDROID_SDK_ROOT "${ANDROID_SDK_SEARCH_PATHS}/android-sdk" CACHE PATH "Location of the Android SDK") + else() + set(ANDROID_SDK_ROOT "/opt/android-sdk" CACHE PATH "Location of the Android SDK") + endif() + endif() + find_program(ANDROID_EMULATOR_PROGRAM emulator PATHS ${ANDROID_SDK_ROOT} PATH_SUFFIXES tools NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) + if(CMAKE_HOST_SYSTEM MATCHES "Windows.*") + find_program(ANDROID_ANDROID_PROGRAM android.bat PATHS ${ANDROID_SDK_ROOT} PATH_SUFFIXES tools NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) + else() + find_program(ANDROID_ANDROID_PROGRAM android PATHS ${ANDROID_SDK_ROOT} PATH_SUFFIXES tools NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) + endif() + find_program(ANDROID_ADB_PROGRAM adb PATHS ${ANDROID_SDK_ROOT} PATH_SUFFIXES platform-tools NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) + if(NOT ANDROID_EMULATOR_PROGRAM OR NOT ANDROID_ANDROID_PROGRAM OR NOT ANDROID_ADB_PROGRAM) + message(FATAL_ERROR "Failed to detect the Android SDK, please set ANDROID_SDK_ROOT to the location of your Android SDK" "or set the missing tools manually!" ) - ELSE() - EXECUTE_PROCESS(COMMAND "${ANDROID_ANDROID_PROGRAM}" list avd RESULT_VARIABLE RESULT OUTPUT_VARIABLE OUTPUT ERROR_QUIET) - STRING(REGEX MATCHALL "Name:[ \t]*[^\r\n]*" ANDROID_AVAILABLE_AVDS ${OUTPUT}) - STRING(REGEX REPLACE "Name:[ \t]*([^\r\n;]*)" "\\1" ANDROID_AVAILABLE_AVDS "${ANDROID_AVAILABLE_AVDS}") - SET(ANDROID_EMULATOR_AVD "${ANDROID_EMULATOR_AVD}" CACHE STRING "Android emulator Android Virtual Device (AVD) configuration" FORCE) - SET_PROPERTY(CACHE ANDROID_EMULATOR_AVD PROPERTY STRINGS ${ANDROID_AVAILABLE_AVDS}) - ENDIF() -ENDFUNCTION(DCMTK_SETUP_ANDROID_EMULATOR) + else() + execute_process(COMMAND "${ANDROID_ANDROID_PROGRAM}" list avd RESULT_VARIABLE RESULT OUTPUT_VARIABLE OUTPUT ERROR_QUIET) + string(REGEX MATCHALL "Name:[ \t]*[^\r\n]*" ANDROID_AVAILABLE_AVDS ${OUTPUT}) + string(REGEX REPLACE "Name:[ \t]*([^\r\n;]*)" "\\1" ANDROID_AVAILABLE_AVDS "${ANDROID_AVAILABLE_AVDS}") + set(ANDROID_EMULATOR_AVD "${ANDROID_EMULATOR_AVD}" CACHE STRING "Android emulator Android Virtual Device (AVD) configuration" FORCE) + set_property(CACHE ANDROID_EMULATOR_AVD PROPERTY STRINGS ${ANDROID_AVAILABLE_AVDS}) + endif() +endfunction() # # Enumerates all currently available Android devices @@ -165,33 +165,33 @@ ENDFUNCTION(DCMTK_SETUP_ANDROID_EMULATOR) # instructions) # Will ignore all additional arguments. # -FUNCTION(DCMTK_ANDROID_LIST_EMULATORS ONLINE OFFLINE) +function(DCMTK_ANDROID_LIST_EMULATORS ONLINE OFFLINE) DCMTK_SETUP_ANDROID_EMULATOR() - IF(ANDROID_ADB_PROGRAM) - EXECUTE_PROCESS( + if(ANDROID_ADB_PROGRAM) + execute_process( COMMAND "${ANDROID_ADB_PROGRAM}" devices RESULT_VARIABLE RESULT OUTPUT_VARIABLE DEVICES_RAW ERROR_QUIET ) - STRING(REPLACE "\n" ";" DEVICES "${DEVICES_RAW}") - FOREACH(DEVICE ${DEVICES}) - STRING(REGEX REPLACE "(.+)\t(.+)" "\\1;\\2" DS "${DEVICE}") - LIST(LENGTH DS DSL) - IF(DSL EQUAL 2) - LIST(GET DS 0 EMULATOR_NAME) - LIST(GET DS 1 EMULATOR_STATE) - IF(EMULATOR_STATE MATCHES "^device$") - LIST(APPEND "${ONLINE}" ${EMULATOR_NAME}) - ELSE() - LIST(APPEND "${OFFLINE}" ${EMULATOR_NAME}) - ENDIF() - ENDIF() - ENDFOREACH() - ENDIF() - SET("${ONLINE}" ${${ONLINE}} PARENT_SCOPE) - SET("${OFFLINE}" ${${OFFLINE}} PARENT_SCOPE) -ENDFUNCTION(DCMTK_ANDROID_LIST_EMULATORS) + string(REPLACE "\n" ";" DEVICES "${DEVICES_RAW}") + foreach(DEVICE ${DEVICES}) + string(REGEX REPLACE "(.+)\t(.+)" "\\1;\\2" DS "${DEVICE}") + list(LENGTH DS DSL) + if(DSL EQUAL 2) + list(GET DS 0 EMULATOR_NAME) + list(GET DS 1 EMULATOR_STATE) + if(EMULATOR_STATE MATCHES "^device$") + list(APPEND "${ONLINE}" ${EMULATOR_NAME}) + else() + list(APPEND "${OFFLINE}" ${EMULATOR_NAME}) + endif() + endif() + endforeach() + endif() + set("${ONLINE}" ${${ONLINE}} PARENT_SCOPE) + set("${OFFLINE}" ${${OFFLINE}} PARENT_SCOPE) +endfunction() # # Generate a random ID that is hopefully unique @@ -200,19 +200,19 @@ ENDFUNCTION(DCMTK_ANDROID_LIST_EMULATORS) # the generated UUID as a string value # Will ignore all additional arguments. # -IF(CMAKE_VERSION VERSION_LESS 2.8.11) -MACRO(DCMTK_ANDROID_EMULATOR_GENERATE_UUID VAR) - STRING(RANDOM LENGTH 20 ALPHABET "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" ${VAR}) -ENDMACRO(DCMTK_ANDROID_EMULATOR_GENERATE_UUID) -ELSE(CMAKE_VERSION VERSION_LESS 2.8.11) -FUNCTION(DCMTK_ANDROID_EMULATOR_GENERATE_UUID VAR) - STRING(RANDOM LENGTH 20 RAND) - STRING(TIMESTAMP TM) - SET(${VAR} "${TM}${RAND}") - STRING(MD5 ${VAR} ${${VAR}}) - SET(${VAR} ${${VAR}} PARENT_SCOPE) -ENDFUNCTION(DCMTK_ANDROID_EMULATOR_GENERATE_UUID) -ENDIF(CMAKE_VERSION VERSION_LESS 2.8.11) +if(CMAKE_VERSION VERSION_LESS 2.8.11) +macro(DCMTK_ANDROID_EMULATOR_GENERATE_UUID VAR) + string(RANDOM LENGTH 20 ALPHABET "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" ${VAR}) +endmacro() +else() +function(DCMTK_ANDROID_EMULATOR_GENERATE_UUID VAR) + string(RANDOM LENGTH 20 RAND) + string(TIMESTAMP TM) + set(${VAR} "${TM}${RAND}") + string(MD5 ${VAR} ${${VAR}}) + set(${VAR} ${${VAR}} PARENT_SCOPE) +endfunction() +endif() # # Tries to query the UUID property of an accessible Android device. @@ -222,21 +222,21 @@ ENDIF(CMAKE_VERSION VERSION_LESS 2.8.11) # is accessible or the device is offline. # Will ignore all additional arguments. # -FUNCTION(DCMTK_ANDROID_GET_EMULATOR_UUID EMULATOR_NAME VAR) - EXECUTE_PROCESS( +function(DCMTK_ANDROID_GET_EMULATOR_UUID EMULATOR_NAME VAR) + execute_process( COMMAND "${ANDROID_ADB_PROGRAM}" -s "${EMULATOR_NAME}" shell getprop "ro.emu.uuid" RESULT_VARIABLE RESULT OUTPUT_VARIABLE OUTPUT ERROR_QUIET ) DCMTK_UNSET_PARENT_SCOPE(${VAR}) - IF(NOT RESULT) - STRING(STRIP "${OUTPUT}" UUID) - IF(UUID) - SET("${VAR}" ${UUID} PARENT_SCOPE) - ENDIF() - ENDIF() -ENDFUNCTION(DCMTK_ANDROID_GET_EMULATOR_UUID) + if(NOT RESULT) + string(STRIP "${OUTPUT}" UUID) + if(UUID) + set("${VAR}" ${UUID} PARENT_SCOPE) + endif() + endif() +endfunction() # # Retrieves the name of the emulator instance referred to by @@ -249,40 +249,40 @@ ENDFUNCTION(DCMTK_ANDROID_GET_EMULATOR_UUID) # one has been found. # Will ignore all additional arguments. # -FUNCTION(DCMTK_ANDROID_GET_EMULATOR_NAME VAR EMULATOR_UUID) +function(DCMTK_ANDROID_GET_EMULATOR_NAME VAR EMULATOR_UUID) DCMTK_ANDROID_LIST_EMULATORS(ONLINE_EMULATORS OFFLINE_EMULATORS) - FOREACH(EMULATOR ${ONLINE_EMULATORS}) + foreach(EMULATOR ${ONLINE_EMULATORS}) DCMTK_ANDROID_GET_EMULATOR_UUID("${EMULATOR}" UUID) - IF(EMULATOR_UUID STREQUAL UUID) - SET("${VAR}" "${EMULATOR}" PARENT_SCOPE) - RETURN() - ENDIF() - ENDFOREACH() - WHILE(OFFLINE_EMULATORS) - LIST(GET OFFLINE_EMULATORS 0 EMULATOR) - LIST(REMOVE_AT OFFLINE_EMULATORS 0) - EXECUTE_PROCESS( + if(EMULATOR_UUID STREQUAL UUID) + set("${VAR}" "${EMULATOR}" PARENT_SCOPE) + return() + endif() + endforeach() + while(OFFLINE_EMULATORS) + list(GET OFFLINE_EMULATORS 0 EMULATOR) + list(REMOVE_AT OFFLINE_EMULATORS 0) + execute_process( COMMAND "${ANDROID_ADB_PROGRAM}" -s "${EMULATOR}" wait-for-device TIMEOUT 1 RESULT_VARIABLE RESULT OUTPUT_QUIET ERROR_QUIET ) - IF(NOT RESULT) + if(NOT RESULT) DCMTK_ANDROID_GET_EMULATOR_UUID("${EMULATOR}" UUID) - IF(UUID) - IF(EMULATOR_UUID STREQUAL UUID) - SET("${VAR}" "${EMULATOR}" PARENT_SCOPE) - RETURN() - ENDIF() - ELSE() - LIST(APPEND OFFLINE_EMULATORS "${EMULATOR}") - ENDIF() - ELSE() - LIST(APPEND OFFLINE_EMULATORS "${EMULATOR}") - ENDIF() - ENDWHILE() -ENDFUNCTION() + if(UUID) + if(EMULATOR_UUID STREQUAL UUID) + set("${VAR}" "${EMULATOR}" PARENT_SCOPE) + return() + endif() + else() + list(APPEND OFFLINE_EMULATORS "${EMULATOR}") + endif() + else() + list(APPEND OFFLINE_EMULATORS "${EMULATOR}") + endif() + endwhile() +endfunction() # # Sets up and starts a new emulator instance or reuses an @@ -295,53 +295,53 @@ ENDFUNCTION() # if VAR does not refer to a valid emulator instance. # Will ignore all additional arguments. # -FUNCTION(DCMTK_ANDROID_START_EMULATOR VAR) +function(DCMTK_ANDROID_START_EMULATOR VAR) DCMTK_SETUP_ANDROID_EMULATOR() - IF(NOT ANDROID_EMULATOR_AVD) - MESSAGE(FATAL_ERROR "Please select which Android emulator Android Virtual Device (AVD) configuration to use!") - ELSE() + if(NOT ANDROID_EMULATOR_AVD) + message(FATAL_ERROR "Please select which Android emulator Android Virtual Device (AVD) configuration to use!") + else() DCMTK_ANDROID_GET_OBJECT_PROPERTIES("${VAR}") - IF(NOT EMULATOR_STATE) + if(NOT EMULATOR_STATE) DCMTK_ANDROID_EMULATOR_GENERATE_UUID(EMULATOR_UUID) - ELSEIF(EMULATOR_STATE STREQUAL "RUNNING") + elseif(EMULATOR_STATE STREQUAL "RUNNING") DCMTK_ANDROID_GET_EMULATOR_UUID("${EMULATOR_NAME}" UUID) # Do nothing if the running emulator instance is ok and can be reused. # Otherwise restart it. - IF(UUID STREQUAL EMULATOR_UUID) - MESSAGE(STATUS "Reusing already running Android device emulator...") - RETURN() - ENDIF() - ELSEIF(EMULATOR_STATE STREQUAL "STARTING") + if(UUID STREQUAL EMULATOR_UUID) + message(STATUS "Reusing already running Android device emulator...") + return() + endif() + elseif(EMULATOR_STATE STREQUAL "STARTING") # Is it really starting, or has somebody aborted it? - MESSAGE(STATUS "Found previously started Android device emulator, checking if it's still present...") + message(STATUS "Found previously started Android device emulator, checking if it's still present...") DCMTK_ANDROID_GET_EMULATOR_NAME(EMULATOR_NAME "${EMULATOR_UUID}") - IF(EMULATOR_NAME) - MESSAGE(STATUS "Found previously started Android device emulator, checking if it's still present... yes") + if(EMULATOR_NAME) + message(STATUS "Found previously started Android device emulator, checking if it's still present... yes") DCMTK_ANDROID_SET_OBJECT_PROPERTIES(${VAR} RUNNING "${EMULATOR_UUID}" "${EMULATOR_NAME}") - RETURN() - ENDIF() - MESSAGE(STATUS "Found previously started Android device emulator, checking if it's still present... no") - ENDIF() - MESSAGE(STATUS "Starting the Android device emulator...") - IF(CMAKE_HOST_SYSTEM MATCHES "Windows.*") - SET(COMMAND sh -c "${ANDROID_EMULATOR_PROGRAM} -avd ${ANDROID_EMULATOR_AVD} -no-boot-anim -prop ro.emu.uuid=${EMULATOR_UUID} >${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/android-emulator.log 2>&1 < /dev/null &") - ELSE() - SET(COMMAND sh -c "${ANDROID_EMULATOR_PROGRAM} -avd ${ANDROID_EMULATOR_AVD} -no-window -no-boot-anim -prop ro.emu.uuid=${EMULATOR_UUID} >${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/android-emulator.log 2>&1 < /dev/null &") - ENDIF() - EXECUTE_PROCESS( + return() + endif() + message(STATUS "Found previously started Android device emulator, checking if it's still present... no") + endif() + message(STATUS "Starting the Android device emulator...") + if(CMAKE_HOST_SYSTEM MATCHES "Windows.*") + set(COMMAND sh -c "${ANDROID_EMULATOR_PROGRAM} -avd ${ANDROID_EMULATOR_AVD} -no-boot-anim -prop ro.emu.uuid=${EMULATOR_UUID} >${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/android-emulator.log 2>&1 < /dev/null &") + else() + set(COMMAND sh -c "${ANDROID_EMULATOR_PROGRAM} -avd ${ANDROID_EMULATOR_AVD} -no-window -no-boot-anim -prop ro.emu.uuid=${EMULATOR_UUID} >${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/android-emulator.log 2>&1 < /dev/null &") + endif() + execute_process( COMMAND ${COMMAND} RESULT_VARIABLE RESULT OUTPUT_QUIET ERROR_QUIET ) - IF(NOT RESULT) + if(NOT RESULT) DCMTK_ANDROID_SET_OBJECT_PROPERTIES("${VAR}" STARTING "${EMULATOR_UUID}" "") - ELSE() + else() DCMTK_ANDROID_DESTROY_OBJECT("${VAR}") - MESSAGE(FATAL_ERROR "Error starting Android emulator.") - ENDIF() - ENDIF() -ENDFUNCTION(DCMTK_ANDROID_START_EMULATOR) + message(FATAL_ERROR "Error starting Android emulator.") + endif() + endif() +endfunction() # # Restart adb/the emulated device in root mode so that we gain write access to @@ -351,8 +351,8 @@ ENDFUNCTION(DCMTK_ANDROID_START_EMULATOR) # EMULATOR_NAME - the name of the emulated device that shall be rooted. # Will ignore all additional arguments. # -FUNCTION(DCMTK_ANDROID_ADB_ROOT EMULATOR_NAME) - EXECUTE_PROCESS( +function(DCMTK_ANDROID_ADB_ROOT EMULATOR_NAME) + execute_process( COMMAND "${ANDROID_ADB_PROGRAM}" -s "${EMULATOR_NAME}" root OUTPUT_QUIET ERROR_QUIET @@ -360,16 +360,16 @@ FUNCTION(DCMTK_ANDROID_ADB_ROOT EMULATOR_NAME) # the SDK was seemingly designed by a five year old, the device will # become invisible while it is being rooted, therefore, wait until # it is ready again - SET(STATUS 1) - WHILE(STATUS) - EXECUTE_PROCESS( + set(STATUS 1) + while(STATUS) + execute_process( COMMAND "${ANDROID_ADB_PROGRAM}" -s "${EMULATOR_NAME}" wait-for-device RESULT_VARIABLE STATUS OUTPUT_QUIET ERROR_QUIET ) - ENDWHILE() -ENDFUNCTION(DCMTK_ANDROID_ADB_ROOT) + endwhile() +endfunction() # # Waits until the given emulator instance becomes online (RUNNING). @@ -382,23 +382,23 @@ ENDFUNCTION(DCMTK_ANDROID_ADB_ROOT) # not become online. # Will ignore all additional arguments. # -FUNCTION(DCMTK_ANDROID_WAIT_FOR_EMULATOR VAR) +function(DCMTK_ANDROID_WAIT_FOR_EMULATOR VAR) DCMTK_ANDROID_GET_OBJECT_PROPERTIES("${VAR}") - IF(NOT EMULATOR_STATE) - MESSAGE(AUTHOR_WARNING "Error: ${VAR} is not a valid Android emulator instance handle.") - ELSEIF(EMULATOR_STATE STREQUAL "RUNNING") + if(NOT EMULATOR_STATE) + message(AUTHOR_WARNING "Error: ${VAR} is not a valid Android emulator instance handle.") + elseif(EMULATOR_STATE STREQUAL "RUNNING") # Emulator is running, no need to wait! - ELSEIF(EMULATOR_STATE STREQUAL "STOPPED") - MESSAGE(WARNING "The Android emulator has stopped, aborting...") - ELSE() - MESSAGE(STATUS "Waiting until the Android device emulator is ready to receive instructions...") - WHILE(NOT EMULATOR_NAME) + elseif(EMULATOR_STATE STREQUAL "STOPPED") + message(WARNING "The Android emulator has stopped, aborting...") + else() + message(STATUS "Waiting until the Android device emulator is ready to receive instructions...") + while(NOT EMULATOR_NAME) DCMTK_ANDROID_GET_EMULATOR_NAME(EMULATOR_NAME "${EMULATOR_UUID}") - ENDWHILE() + endwhile() DCMTK_ANDROID_ADB_ROOT("${EMULATOR_NAME}") DCMTK_ANDROID_SET_OBJECT_PROPERTIES("${VAR}" RUNNING "${EMULATOR_UUID}" "${EMULATOR_NAME}") - ENDIF() -ENDFUNCTION(DCMTK_ANDROID_WAIT_FOR_EMULATOR) + endif() +endfunction() # # Prepare a command that will shutdown the given Android emulator when @@ -411,13 +411,13 @@ ENDFUNCTION(DCMTK_ANDROID_WAIT_FOR_EMULATOR) # be generated for the current host platform (Windows). # Will ignore all additional arguments. # -MACRO(DCMTK_ANDROID_STOP_EMULATOR_COMMAND VAR EMULATOR_NAME) - IF(CMAKE_HOST_SYSTEM MATCHES "Windows.*") - UNSET("${VAR}") - ELSE() - SET("${VAR}" "${ANDROID_ADB_PROGRAM}" -s "${EMULATOR_NAME}" emu kill) - ENDIF() -ENDMACRO(DCMTK_ANDROID_STOP_EMULATOR_COMMAND) +macro(DCMTK_ANDROID_STOP_EMULATOR_COMMAND VAR EMULATOR_NAME) + if(CMAKE_HOST_SYSTEM MATCHES "Windows.*") + unset("${VAR}") + else() + set("${VAR}" "${ANDROID_ADB_PROGRAM}" -s "${EMULATOR_NAME}" emu kill) + endif() +endmacro() # # Prepare an emulator shutdown message or a warning message if automated @@ -425,13 +425,13 @@ ENDMACRO(DCMTK_ANDROID_STOP_EMULATOR_COMMAND) # VAR - the name of the variable that will be set to the generated message # Will ignore all additional arguments. # -MACRO(DCMTK_ANDROID_EMULATOR_SHUTDOWN_MESSAGE VAR) - IF(CMAKE_HOST_SYSTEM MATCHES "Windows.*") - SET("${VAR}" WARNING "The Android device emulator can't be terminated automatically under Windows, please shutdown \"${EMULATOR_NAME}\" manually!") - ELSE() - SET("${VAR}" STATUS "Shutting down the Android device emulator...") - ENDIF() -ENDMACRO(DCMTK_ANDROID_EMULATOR_SHUTDOWN_MESSAGE) +macro(DCMTK_ANDROID_EMULATOR_SHUTDOWN_MESSAGE VAR) + if(CMAKE_HOST_SYSTEM MATCHES "Windows.*") + set("${VAR}" WARNING "The Android device emulator can't be terminated automatically under Windows, please shutdown \"${EMULATOR_NAME}\" manually!") + else() + set("${VAR}" STATUS "Shutting down the Android device emulator...") + endif() +endmacro() # # Stops the emulator and sets its state to STOPPED when successful. @@ -441,34 +441,34 @@ ENDMACRO(DCMTK_ANDROID_EMULATOR_SHUTDOWN_MESSAGE) # won't modify its state in that case. # Will ignore all additional arguments. # -FUNCTION(DCMTK_ANDROID_STOP_EMULATOR VAR) +function(DCMTK_ANDROID_STOP_EMULATOR VAR) DCMTK_ANDROID_GET_OBJECT_PROPERTIES("${VAR}") - IF(NOT EMULATOR_STATE) - MESSAGE(AUTHOR_WARNING "Error: ${VAR} is not a valid Android emulator instance handle.") - ELSEIF(EMULATOR_STATE STREQUAL "STARTING") + if(NOT EMULATOR_STATE) + message(AUTHOR_WARNING "Error: ${VAR} is not a valid Android emulator instance handle.") + elseif(EMULATOR_STATE STREQUAL "STARTING") # Can't tell it to stop if it is not done starting DCMTK_ANDROID_WAIT_FOR_EMULATOR("${VAR}") - ELSEIF(EMULATOR_STATE STREQUAL "STOPPED") + elseif(EMULATOR_STATE STREQUAL "STOPPED") # Emulator is already stopped, do nothing - RETURN() - ENDIF() + return() + endif() DCMTK_ANDROID_EMULATOR_SHUTDOWN_MESSAGE(MESSAGE) - MESSAGE(${MESSAGE}) - IF(NOT CMAKE_HOST_SYSTEM MATCHES "Windows.*") + message(${MESSAGE}) + if(NOT CMAKE_HOST_SYSTEM MATCHES "Windows.*") DCMTK_ANDROID_STOP_EMULATOR_COMMAND(COMMAND "${EMULATOR_NAME}") - EXECUTE_PROCESS( + execute_process( COMMAND ${COMMAND} RESULT_VARIABLE RESULT OUTPUT_QUIET ERROR_QUIET ) - IF(NOT RESULT) + if(NOT RESULT) DCMTK_ANDROID_SET_OBJECT_PROPERTIES("${VAR}" STOPPED "${EMULATOR_UUID}" "") - ELSE() - MESSAGE(WARNING "Unable to stop the android device emulator, please shutdown \"${EMULATOR_NAME}\" manually!") - ENDIF() - ENDIF() -ENDFUNCTION(DCMTK_ANDROID_STOP_EMULATOR) + else() + message(WARNING "Unable to stop the android device emulator, please shutdown \"${EMULATOR_NAME}\" manually!") + endif() + endif() +endfunction() # # Uploads local files to the given Android device using 'adb push'. @@ -476,26 +476,26 @@ ENDFUNCTION(DCMTK_ANDROID_STOP_EMULATOR) # device # Requires the device to be running. # Additional arguments will be parsed and interpreted similar to -# CMake's FILE(COPY ...) command. +# CMake's file(COPY ...) command. # -FUNCTION(DCMTK_ANDROID_PUSH VAR) +function(DCMTK_ANDROID_PUSH VAR) DCMTK_ANDROID_GET_OBJECT_PROPERTIES("${VAR}") - IF(NOT EMULATOR_STATE) - MESSAGE(AUTHOR_WARNING "Error: ${VAR} is not a valid Android emulator instance handle.") - ELSEIF(EMULATOR_STATE STREQUAL "RUNNING") - CMAKE_PARSE_ARGUMENTS(DCMTK_ANDROID_PUSH "" "" "DESTINATION" ${ARGN}) - FOREACH(LOCAL_FILE ${DCMTK_ANDROID_PUSH_UNPARSED_ARGUMENTS}) - EXECUTE_PROCESS( + if(NOT EMULATOR_STATE) + message(AUTHOR_WARNING "Error: ${VAR} is not a valid Android emulator instance handle.") + elseif(EMULATOR_STATE STREQUAL "RUNNING") + cmake_parse_arguments(DCMTK_ANDROID_PUSH "" "" "DESTINATION" ${ARGN}) + foreach(LOCAL_FILE ${DCMTK_ANDROID_PUSH_UNPARSED_ARGUMENTS}) + execute_process( COMMAND "${ANDROID_ADB_PROGRAM}" -s "${EMULATOR_NAME}" push "${LOCAL_FILE}" "${DCMTK_ANDROID_PUSH_DESTINATION}" RESULT_VARIABLE RESULT OUTPUT_QUIET ERROR_QUIET ) - ENDFOREACH() - ELSE() - MESSAGE(AUTHOR_WARNING "Error: the Android emulator \"${VAR}\" is not ready to receive commands") - ENDIF() -ENDFUNCTION(DCMTK_ANDROID_PUSH) + endforeach() + else() + message(AUTHOR_WARNING "Error: the Android emulator \"${VAR}\" is not ready to receive commands") + endif() +endfunction() # # Downloads remote files from the given Android device using 'adb pull'. @@ -503,26 +503,26 @@ ENDFUNCTION(DCMTK_ANDROID_PUSH) # device # Requires the device to be running. # Additional arguments will be parsed and interpreted similar to -# CMake's FILE(COPY ...) command. +# CMake's file(COPY ...) command. # -FUNCTION(DCMTK_ANDROID_PULL VAR) +function(DCMTK_ANDROID_PULL VAR) DCMTK_ANDROID_GET_OBJECT_PROPERTIES("${VAR}") - IF(NOT EMULATOR_STATE) - MESSAGE(AUTHOR_WARNING "Error: ${VAR} is not a valid Android emulator instance handle.") - ELSEIF(EMULATOR_STATE STREQUAL "RUNNING") - CMAKE_PARSE_ARGUMENTS(DCMTK_ANDROID_PULL "" "" "DESTINATION" ${ARGN}) - FOREACH(REMOTE_FILE ${DCMTK_ANDROID_PULL_UNPARSED_ARGUMENTS}) - EXECUTE_PROCESS( + if(NOT EMULATOR_STATE) + message(AUTHOR_WARNING "Error: ${VAR} is not a valid Android emulator instance handle.") + elseif(EMULATOR_STATE STREQUAL "RUNNING") + cmake_parse_arguments(DCMTK_ANDROID_PULL "" "" "DESTINATION" ${ARGN}) + foreach(REMOTE_FILE ${DCMTK_ANDROID_PULL_UNPARSED_ARGUMENTS}) + execute_process( COMMAND "${ANDROID_ADB_PROGRAM}" -s "${EMULATOR_NAME}" pull "${REMOTE_FILE}" "${DCMTK_ANDROID_PULL_DESTINATION}" RESULT_VARIABLE RESULT OUTPUT_QUIET ERROR_QUIET ) - ENDFOREACH() - ELSE() - MESSAGE(AUTHOR_WARNING "Error: the Android emulator \"${VAR}\" is not ready to receive commands") - ENDIF() -ENDFUNCTION(DCMTK_ANDROID_PULL) + endforeach() + else() + message(AUTHOR_WARNING "Error: the Android emulator \"${VAR}\" is not ready to receive commands") + endif() +endfunction() # # Executes a shell command on the given Android device using 'adb shell'. @@ -530,14 +530,14 @@ ENDFUNCTION(DCMTK_ANDROID_PULL) # device # Requires the device to be running. # Additional arguments will be parsed and interpreted similar to -# CMake's EXECUTE_PROCESS(...) command. +# CMake's execute_process(...) command. # -FUNCTION(DCMTK_ANDROID_SHELL VAR) +function(DCMTK_ANDROID_SHELL VAR) DCMTK_ANDROID_GET_OBJECT_PROPERTIES("${VAR}") - IF(NOT EMULATOR_STATE) - MESSAGE(AUTHOR_WARNING "Error: ${VAR} is not a valid Android emulator instance handle.") - ELSEIF(EMULATOR_STATE STREQUAL "RUNNING") - CMAKE_PARSE_ARGUMENTS(DCMTK_ANDROID_SHELL + if(NOT EMULATOR_STATE) + message(AUTHOR_WARNING "Error: ${VAR} is not a valid Android emulator instance handle.") + elseif(EMULATOR_STATE STREQUAL "RUNNING") + cmake_parse_arguments(DCMTK_ANDROID_SHELL "OUTPUT_QUIET;ERROR_QUIET" "RESULT_VARIABLE;OUTPUT_VARIABLE;ERROR_VARIABLE;WORKING_DIRECTORY" "COMMAND" @@ -545,52 +545,52 @@ FUNCTION(DCMTK_ANDROID_SHELL VAR) ) # Prepare commandline - SET(COMMAND "${ANDROID_ADB_PROGRAM}" -s "${EMULATOR_NAME}" shell) - IF(DCMTK_ANDROID_SHELL_WORKING_DIRECTORY) - LIST(APPEND COMMAND "cd" "${DCMTK_ANDROID_SHELL_WORKING_DIRECTORY}" "&&") - ENDIF() - LIST(APPEND COMMAND "${DCMTK_ANDROID_SHELL_COMMAND}") + set(COMMAND "${ANDROID_ADB_PROGRAM}" -s "${EMULATOR_NAME}" shell) + if(DCMTK_ANDROID_SHELL_WORKING_DIRECTORY) + list(APPEND COMMAND "cd" "${DCMTK_ANDROID_SHELL_WORKING_DIRECTORY}" "&&") + endif() + list(APPEND COMMAND "${DCMTK_ANDROID_SHELL_COMMAND}") # Inspect output variable parameters - IF(DCMTK_ANDROID_SHELL_OUTPUT_VARIABLE) - SET(PUSH_OUTPUT_VAR TRUE) - IF(DCMTK_ANDROID_SHELL_ERROR_VARIABLE) - IF(DCMTK_ANDROID_SHELL_ERROR_VARIABLE STREQUAL DCMTK_ANDROID_SHELL_OUTPUT_VARIABLE) - SET(STREAMS_MERGED TRUE) - ELSE() - SET(PUSH_ERROR_VAR TRUE) - ENDIF() - ELSE() - SET(DCMTK_ANDROID_SHELL_ERROR_VARIABLE DCMTK_ANDROID_SHELL_ERROR_MESSAGE_BUFFER) - ENDIF() - ELSE() - SET(DCMTK_ANDROID_SHELL_OUTPUT_VARIABLE DCMTK_ANDROID_SHELL_OUTPUT_MESSAGE_BUFFER) - IF(DCMTK_ANDROID_SHELL_ERROR_VARIABLE) - SET(PUSH_ERROR_VAR TRUE) - ELSE() - SET(STREAMS_MERGED TRUE) - ENDIF() - ENDIF() + if(DCMTK_ANDROID_SHELL_OUTPUT_VARIABLE) + set(PUSH_OUTPUT_VAR TRUE) + if(DCMTK_ANDROID_SHELL_ERROR_VARIABLE) + if(DCMTK_ANDROID_SHELL_ERROR_VARIABLE STREQUAL DCMTK_ANDROID_SHELL_OUTPUT_VARIABLE) + set(STREAMS_MERGED TRUE) + else() + set(PUSH_ERROR_VAR TRUE) + endif() + else() + set(DCMTK_ANDROID_SHELL_ERROR_VARIABLE DCMTK_ANDROID_SHELL_ERROR_MESSAGE_BUFFER) + endif() + else() + set(DCMTK_ANDROID_SHELL_OUTPUT_VARIABLE DCMTK_ANDROID_SHELL_OUTPUT_MESSAGE_BUFFER) + if(DCMTK_ANDROID_SHELL_ERROR_VARIABLE) + set(PUSH_ERROR_VAR TRUE) + else() + set(STREAMS_MERGED TRUE) + endif() + endif() # Prefix to prevent collision of output capturing files - IF(CMAKE_VERSION VERSION_LESS 2.8.7) - STRING(RANDOM LENGTH 20 ALPHABET "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" PREFIX) - ELSE() - STRING(MD5 PREFIX "${DCMTK_ANDROID_SHELL_COMMAND}") - ENDIF() + if(CMAKE_VERSION VERSION_LESS 2.8.7) + string(RANDOM LENGTH 20 ALPHABET "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" PREFIX) + else() + string(MD5 PREFIX "${DCMTK_ANDROID_SHELL_COMMAND}") + endif() # Prepare output redirection (buffering) - IF(STREAMS_MERGED) - LIST(APPEND COMMAND > "${ANDROID_TEMPORARY_FILES_LOCATION}/${PREFIX}_output" 2>&1) - ELSE() - LIST(APPEND COMMAND > "${ANDROID_TEMPORARY_FILES_LOCATION}/${PREFIX}_output" 2> "${ANDROID_TEMPORARY_FILES_LOCATION}/${PREFIX}_error") - ENDIF() + if(STREAMS_MERGED) + list(APPEND COMMAND > "${ANDROID_TEMPORARY_FILES_LOCATION}/${PREFIX}_output" 2>&1) + else() + list(APPEND COMMAND > "${ANDROID_TEMPORARY_FILES_LOCATION}/${PREFIX}_output" 2> "${ANDROID_TEMPORARY_FILES_LOCATION}/${PREFIX}_error") + endif() # Prepare capturing the result - LIST(APPEND COMMAND "\;" echo -n $? > "${ANDROID_TEMPORARY_FILES_LOCATION}/${PREFIX}_result") + list(APPEND COMMAND "\;" echo -n $? > "${ANDROID_TEMPORARY_FILES_LOCATION}/${PREFIX}_result") # Run the command - EXECUTE_PROCESS( + execute_process( COMMAND ${COMMAND} RESULT_VARIABLE ADB_RESULT OUTPUT_VARIABLE ADB_OUTPUT @@ -598,50 +598,50 @@ FUNCTION(DCMTK_ANDROID_SHELL VAR) ) # Deal with it - IF(ADB_RESULT) - MESSAGE(WARNING "Error sending command to the Android emulator, adb reported the error: ${ADB_OUTPUT}") - IF(DCMTK_ANDROID_SHELL_RESULT_VARIABLE) - SET("${DCMTK_ANDROID_SHELL_RESULT_VARIABLE}" ${ADB_RESULT} PARENT_SCOPE) - ENDIF() - ELSE(ADB_RESULT) + if(ADB_RESULT) + message(WARNING "Error sending command to the Android emulator, adb reported the error: ${ADB_OUTPUT}") + if(DCMTK_ANDROID_SHELL_RESULT_VARIABLE) + set("${DCMTK_ANDROID_SHELL_RESULT_VARIABLE}" ${ADB_RESULT} PARENT_SCOPE) + endif() + else() # Receive results DCMTK_ANDROID_PULL("${VAR}" "${ANDROID_TEMPORARY_FILES_LOCATION}/${PREFIX}_output" "${ANDROID_TEMPORARY_FILES_LOCATION}/${PREFIX}_error" "${ANDROID_TEMPORARY_FILES_LOCATION}/${PREFIX}_result" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}" ) # Cleanup temp files - EXECUTE_PROCESS( + execute_process( COMMAND "${ANDROID_ADB_PROGRAM}" -s "${EMULATOR_NAME}" shell rm "${ANDROID_TEMPORARY_FILES_LOCATION}/${PREFIX}_output" "\;" rm "${ANDROID_TEMPORARY_FILES_LOCATION}/${PREFIX}_error" "\;" rm "${ANDROID_TEMPORARY_FILES_LOCATION}/${PREFIX}_result" RESULT_VARIABLE RESULT_QUIET OUTPUT_QUIET ERROR_QUIET ) # Analyze results - IF(DCMTK_ANDROID_SHELL_RESULT_VARIABLE) - FILE(READ "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PREFIX}_result" "${DCMTK_ANDROID_SHELL_RESULT_VARIABLE}") - SET("${DCMTK_ANDROID_SHELL_RESULT_VARIABLE}" ${${DCMTK_ANDROID_SHELL_RESULT_VARIABLE}} PARENT_SCOPE) - ENDIF() - IF(NOT DCMTK_ANDROID_SHELL_OUTPUT_QUIET OR (STREAMS_MERGED AND NOT DCMTK_ANDROID_SHELL_ERROR_QUIET)) - FILE(READ "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PREFIX}_output" "${DCMTK_ANDROID_SHELL_OUTPUT_VARIABLE}") - IF(PUSH_OUTPUT_VAR) - SET("${DCMTK_ANDROID_SHELL_OUTPUT_VARIABLE}" ${${DCMTK_ANDROID_SHELL_OUTPUT_VARIABLE}} PARENT_SCOPE) - ELSE() - MESSAGE("${${DCMTK_ANDROID_SHELL_OUTPUT_VARIABLE}}") - ENDIF() - ENDIF() - IF(NOT DCMTK_ANDROID_SHELL_ERROR_QUIET AND NOT STREAMS_MERGED) - FILE(READ "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PREFIX}_error" "${DCMTK_ANDROID_SHELL_ERROR_VARIABLE}") - IF(PUSH_ERROR_VAR) - SET("${DCMTK_ANDROID_SHELL_ERROR_VARIABLE}" ${${DCMTK_ANDROID_SHELL_ERROR_VARIABLE}} PARENT_SCOPE) - ELSE() - MESSAGE("${${DCMTK_ANDROID_SHELL_ERROR_VARIABLE}}") - ENDIF() - ENDIF() + if(DCMTK_ANDROID_SHELL_RESULT_VARIABLE) + file(READ "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PREFIX}_result" "${DCMTK_ANDROID_SHELL_RESULT_VARIABLE}") + set("${DCMTK_ANDROID_SHELL_RESULT_VARIABLE}" ${${DCMTK_ANDROID_SHELL_RESULT_VARIABLE}} PARENT_SCOPE) + endif() + if(NOT DCMTK_ANDROID_SHELL_OUTPUT_QUIET OR (STREAMS_MERGED AND NOT DCMTK_ANDROID_SHELL_ERROR_QUIET)) + file(READ "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PREFIX}_output" "${DCMTK_ANDROID_SHELL_OUTPUT_VARIABLE}") + if(PUSH_OUTPUT_VAR) + set("${DCMTK_ANDROID_SHELL_OUTPUT_VARIABLE}" ${${DCMTK_ANDROID_SHELL_OUTPUT_VARIABLE}} PARENT_SCOPE) + else() + message("${${DCMTK_ANDROID_SHELL_OUTPUT_VARIABLE}}") + endif() + endif() + if(NOT DCMTK_ANDROID_SHELL_ERROR_QUIET AND NOT STREAMS_MERGED) + file(READ "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PREFIX}_error" "${DCMTK_ANDROID_SHELL_ERROR_VARIABLE}") + if(PUSH_ERROR_VAR) + set("${DCMTK_ANDROID_SHELL_ERROR_VARIABLE}" ${${DCMTK_ANDROID_SHELL_ERROR_VARIABLE}} PARENT_SCOPE) + else() + message("${${DCMTK_ANDROID_SHELL_ERROR_VARIABLE}}") + endif() + endif() # Cleanup temp files - FILE(REMOVE "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PREFIX}_result") - FILE(REMOVE "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PREFIX}_output") - FILE(REMOVE "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PREFIX}_error") - ENDIF(ADB_RESULT) - ELSE() - MESSAGE(AUTHOR_WARNING "Error: the Android emulator \"${VAR}\" is not ready to receive commands") - ENDIF() -ENDFUNCTION(DCMTK_ANDROID_SHELL) + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PREFIX}_result") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PREFIX}_output") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PREFIX}_error") + endif() + else() + message(AUTHOR_WARNING "Error: the Android emulator \"${VAR}\" is not ready to receive commands") + endif() +endfunction() diff --git a/CMake/dcmtkUseWine.cmake b/CMake/dcmtkUseWine.cmake index 34336424ad..5011033c57 100644 --- a/CMake/dcmtkUseWine.cmake +++ b/CMake/dcmtkUseWine.cmake @@ -8,52 +8,52 @@ # error that will halt the configuration process if that is not possible. # All arguments will be ignored. # -FUNCTION(DCMTK_SETUP_WINE) - FIND_PROGRAM(WINE_WINE_PROGRAM wine) - FIND_PROGRAM(WINE_WINEPATH_PROGRAM winepath) - IF(NOT WINE_CPP_RUNTIME) - SET(v 1) - UNSET(CMAKE_FIND_LIBRARY_SUFFIXES) - WHILE(${v} LESS 14) - LIST(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "-${v}.dll") - MATH(EXPR v "${v} + 1") - ENDWHILE() - FIND_LIBRARY(CPP_RUNTIME stdc++ DOC "Location of the C++ runtime library used during target emulation") - IF(NOT CPP_RUNTIME) - MESSAGE(FATAL_ERROR "Please set the C++ runtime location (required for running applications targeting Windows).") - ELSE() - GET_FILENAME_COMPONENT(CPP_RUNTIME_LOCATION ${CPP_RUNTIME} PATH) +function(DCMTK_SETUP_WINE) + find_program(WINE_WINE_PROGRAM wine) + find_program(WINE_WINEPATH_PROGRAM winepath) + if(NOT WINE_CPP_RUNTIME) + set(v 1) + unset(CMAKE_FIND_LIBRARY_SUFFIXES) + while(${v} LESS 14) + list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "-${v}.dll") + math(EXPR v "${v} + 1") + endwhile() + find_library(CPP_RUNTIME stdc++ DOC "Location of the C++ runtime library used during target emulation") + if(NOT CPP_RUNTIME) + message(FATAL_ERROR "Please set the C++ runtime location (required for running applications targeting Windows).") + else() + get_filename_component(CPP_RUNTIME_LOCATION ${CPP_RUNTIME} PATH) UNIX_TO_WINE_PATH(RT ${CPP_RUNTIME_LOCATION}) - SET(WINE_CPP_RUNTIME ${RT} CACHE INTERNAL "C++ RT in Wine path format") - ENDIF() - ENDIF() - IF(NOT WINE_WINE_PROGRAM OR NOT WINE_WINEPATH_PROGRAM) - MESSAGE(FATAL_ERROR + set(WINE_CPP_RUNTIME ${RT} CACHE INTERNAL "C++ RT in Wine path format") + endif() + endif() + if(NOT WINE_WINE_PROGRAM OR NOT WINE_WINEPATH_PROGRAM) + message(FATAL_ERROR "Some wine related executables could not be detected automatically. " "Please set WINE_WINE_PROGRAM and WINE_WINEPATH_PROGRAM appropriately." ) - ENDIF() + endif() # prepare wine prefix for configure and unit tests - IF(NOT DCMTK_WINEPREFIX) - SET(DCMTK_WINEPREFIX "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/wineprefix" CACHE INTERNALE "the path of the wineprefix to use for configuration and unit tests") - MESSAGE(STATUS "Info: Preparing wine prefix for configuration and unit tests: ${DCMTK_WINEPREFIX}") - STRING(REPLACE "\\" "\\\\" WINE_CPP_RUNTIME "${WINE_CPP_RUNTIME}") - SET(WINE_PATH_REG "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/dcmtkWinePath.reg") - CONFIGURE_FILE("${DCMTK_SOURCE_DIR}/CMake/dcmtkWinePath.reg.in" "${WINE_PATH_REG}" ESCAPE_QUOTES @ONLY) - SET(ENV{WINEPREFIX} "${DCMTK_WINEPREFIX}") - EXECUTE_PROCESS(COMMAND "${WINE_WINE_PROGRAM}" "regedit" "${WINE_PATH_REG}" + if(NOT DCMTK_WINEPREFIX) + set(DCMTK_WINEPREFIX "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/wineprefix" CACHE INTERNALE "the path of the wineprefix to use for configuration and unit tests") + message(STATUS "Info: Preparing wine prefix for configuration and unit tests: ${DCMTK_WINEPREFIX}") + string(REPLACE "\\" "\\\\" WINE_CPP_RUNTIME "${WINE_CPP_RUNTIME}") + set(WINE_PATH_REG "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/dcmtkWinePath.reg") + configure_file("${DCMTK_SOURCE_DIR}/CMake/dcmtkWinePath.reg.in" "${WINE_PATH_REG}" ESCAPE_QUOTES @ONLY) + set(ENV{WINEPREFIX} "${DCMTK_WINEPREFIX}") + execute_process(COMMAND "${WINE_WINE_PROGRAM}" "regedit" "${WINE_PATH_REG}" OUTPUT_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/wineprefix.log" ERROR_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/wineprefix.log" OUTPUT_VARIABLE RESULT ) - IF(RESULT) - SET(DCMTK_WINEPREFIX CACHE INTERNAL "error, see ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/wineprefix.log") - MESSAGE(FATAL_ERROR "Failed to setup the wineprefix, see \"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/wineprefix.log\"") - ENDIF() - ELSE() - SET(ENV{WINEPREFIX} "${DCMTK_WINEPREFIX}") - ENDIF() -ENDFUNCTION(DCMTK_SETUP_WINE) + if(RESULT) + set(DCMTK_WINEPREFIX CACHE INTERNAL "error, see ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/wineprefix.log") + message(FATAL_ERROR "Failed to setup the wineprefix, see \"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/wineprefix.log\"") + endif() + else() + set(ENV{WINEPREFIX} "${DCMTK_WINEPREFIX}") + endif() +endfunction() # # Helper function to detach the output and error streams from a wine process, so @@ -63,36 +63,36 @@ ENDFUNCTION(DCMTK_SETUP_WINE) # ERROR_VAR - the variable that will hold the error output of the launched process. # ARGN - the command to execute. # -FUNCTION(WINE_DETACHED VAR OUTPUT_VAR ERROR_VAR) +function(WINE_DETACHED VAR OUTPUT_VAR ERROR_VAR) # Prefix to prevent collision of output capturing files - IF(CMAKE_VERSION VERSION_LESS 2.8.7) - STRING(RANDOM LENGTH 20 ALPHABET "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" PREFIX) - ELSE() - STRING(MD5 PREFIX "${ARGN}") - ENDIF() - SET(OUTPUT_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PREFIX}_output") - IF(OUTPUT_VAR STREQUAL ERROR_VAR) - SET(ERROR_FILE "${OUTPUT_FILE}") - ELSE() - SET(ERROR_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PREFIX}_error") - ENDIF() - EXECUTE_PROCESS( + if(CMAKE_VERSION VERSION_LESS 2.8.7) + string(RANDOM LENGTH 20 ALPHABET "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" PREFIX) + else() + string(MD5 PREFIX "${ARGN}") + endif() + set(OUTPUT_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PREFIX}_output") + if(OUTPUT_VAR STREQUAL ERROR_VAR) + set(ERROR_FILE "${OUTPUT_FILE}") + else() + set(ERROR_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PREFIX}_error") + endif() + execute_process( COMMAND ${ARGN} OUTPUT_FILE "${OUTPUT_FILE}" ERROR_FILE "${ERROR_FILE}" RESULT_VARIABLE RESULT ) - FILE(READ "${OUTPUT_FILE}" OUTPUT) - SET("${OUTPUT_VAR}" ${OUTPUT} PARENT_SCOPE) - IF(OUTPUT_VAR STREQUAL ERROR_VAR) - FILE(REMOVE "${OUTPUT_FILE}") - ELSE() - FILE(READ "${ERROR_FILE}" ERROR) - SET("${ERROR_VAR}" ${ERROR} PARENT_SCOPE) - FILE(REMOVE "${OUTPUT_FILE}" "${ERROR_FILE}") - ENDIF() - SET("${VAR}" ${RESULT} PARENT_SCOPE) -ENDFUNCTION(WINE_DETACHED) + file(READ "${OUTPUT_FILE}" OUTPUT) + set("${OUTPUT_VAR}" ${OUTPUT} PARENT_SCOPE) + if(OUTPUT_VAR STREQUAL ERROR_VAR) + file(REMOVE "${OUTPUT_FILE}") + else() + file(READ "${ERROR_FILE}" ERROR) + set("${ERROR_VAR}" ${ERROR} PARENT_SCOPE) + file(REMOVE "${OUTPUT_FILE}" "${ERROR_FILE}") + endif() + set("${VAR}" ${RESULT} PARENT_SCOPE) +endfunction() # # Uses 'winepath' to translate a host path or filename to the location it can be @@ -102,16 +102,16 @@ ENDFUNCTION(WINE_DETACHED) # Will unset VAR if an error occurred. # Additional arguments will be ignored. # -FUNCTION(UNIX_TO_WINE_PATH VAR PATH) +function(UNIX_TO_WINE_PATH VAR PATH) WINE_DETACHED(ERROR RESULT STDERR "${WINE_WINEPATH_PROGRAM}" "-w" "${PATH}") - IF(NOT ERROR) - STRING(REPLACE "\n" "" RESULT ${RESULT}) - SET(${VAR} ${RESULT} PARENT_SCOPE) - ELSE() - UNSET(${VAR} PARENT_SCOPE) - MESSAGE(WARNING "Unable to convert path to Wine format: ${STDERR}") - ENDIF() -ENDFUNCTION() + if(NOT ERROR) + string(REPLACE "\n" "" RESULT ${RESULT}) + set(${VAR} ${RESULT} PARENT_SCOPE) + else() + unset(${VAR} PARENT_SCOPE) + message(WARNING "Unable to convert path to Wine format: ${STDERR}") + endif() +endfunction() # # Create a command (as string) to run a given command in the emulated Windows @@ -120,8 +120,8 @@ ENDFUNCTION() # COMMAND - the command to run, e. g. 'dir' # Additional arguments will be appended to the command. # -FUNCTION(WINE_COMMAND VAR COMMAND) +function(WINE_COMMAND VAR COMMAND) UNIX_TO_WINE_PATH(CMD ${COMMAND}) - SEPARATE_ARGUMENTS(ARGS WINDOWS_COMMAND "${ARGN}") - SET(${VAR} "${CMD}" ${ARGS} PARENT_SCOPE) -ENDFUNCTION() + separate_arguments(ARGS WINDOWS_COMMAND "${ARGN}") + set(${VAR} "${CMD}" ${ARGS} PARENT_SCOPE) +endfunction() diff --git a/CMakeLists.txt b/CMakeLists.txt index 91f68e1402..9f1e02be26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,20 +1,20 @@ # Declare project -PROJECT(DCMTK) +project(DCMTK) # Minimum CMake version required -CMAKE_MINIMUM_REQUIRED(VERSION 2.8.5) +cmake_minimum_required(VERSION 2.8.5) # Disables a warning emitted by CMake 3.7.2. The same setting is performed # again in CMake/dcmtkPrepare.cmake (included below), but the warning is still # emitted if it is not set here (it only goes away if the policy is set in # both files). # We do not entirely understand this behavior, perhaps it is a bug in CMake? -IF(POLICY CMP0017) - CMAKE_POLICY(SET CMP0017 NEW) -ENDIF() +if(POLICY CMP0017) + cmake_policy(SET CMP0017 NEW) +endif() # Check the build system -INCLUDE(CMake/dcmtkPrepare.cmake NO_POLICY_SCOPE) +include(CMake/dcmtkPrepare.cmake NO_POLICY_SCOPE) #----------------------------------------------------------------------------- # General project settings to configure DCMTK build process @@ -22,7 +22,7 @@ INCLUDE(CMake/dcmtkPrepare.cmake NO_POLICY_SCOPE) # Modules to be built -SET(DCMTK_MODULES ofstd oflog dcmdata dcmimgle +set(DCMTK_MODULES ofstd oflog dcmdata dcmimgle dcmimage dcmjpeg dcmjpls dcmtls dcmnet dcmsr dcmsign dcmwlm dcmqrdb dcmpstat dcmrt dcmiod dcmfg dcmseg dcmtract dcmpmap CACHE STRING "List of modules that should be built.") @@ -31,19 +31,19 @@ SET(DCMTK_MODULES ofstd oflog dcmdata dcmimgle # Include directories #----------------------------------------------------------------------------- -SET(DCMTK_INCLUDE_DIR "${DCMTK_BINARY_DIR}/config/include") -FOREACH(inc ${DCMTK_MODULES}) - LIST(APPEND DCMTK_INCLUDE_DIR "${DCMTK_SOURCE_DIR}/${inc}/include") -ENDFOREACH(inc) +set(DCMTK_INCLUDE_DIR "${DCMTK_BINARY_DIR}/config/include") +foreach(inc ${DCMTK_MODULES}) + list(APPEND DCMTK_INCLUDE_DIR "${DCMTK_SOURCE_DIR}/${inc}/include") +endforeach() -INCLUDE_DIRECTORIES(${DCMTK_INCLUDE_DIR}) +include_directories(${DCMTK_INCLUDE_DIR}) #----------------------------------------------------------------------------- # Prepare osconfig.h #----------------------------------------------------------------------------- # add the osconfig.h.in file -CONFIGURE_FILE("${DCMTK_SOURCE_DIR}/CMake/osconfig.h.in" +configure_file("${DCMTK_SOURCE_DIR}/CMake/osconfig.h.in" "${DCMTK_BINARY_DIR}/config/include/dcmtk/config/osconfig.h") #----------------------------------------------------------------------------- @@ -56,19 +56,19 @@ INSPECT_FUNDAMENTAL_ARITHMETIC_TYPES() # Unit test related configuration/setup # ---------------------------------------------------------------------------- -IF(CMAKE_CROSSCOMPILING) - IF(WIN32) - SET(DCMTK_RUN_CTEST_SCRIPT "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/dcmtkCTestRunWine.cmake" CACHE INTERNAL "path to the CMake script for launching a unit test as a detached Wine process in the prepared wineprefix") - ELSEIF(ANDROID) - SET(DCMTK_RUN_CTEST_SCRIPT "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/dcmtkCTestRunAndroid.cmake" CACHE INTERNAL "path to the CMake script for launching a unit test via the android emulator") - ELSE() - MESSAGE(WARNING "Emulation for your target platform is not available, CTest will not be able to execute the unit tests!") - ENDIF() -ELSE(CMAKE_CROSSCOMPILING) - SET(DCMTK_RUN_CTEST_SCRIPT "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/dcmtkCTestRun.cmake" CACHE INTERNAL "path to the CMake script for launching a unit test") -ENDIF(CMAKE_CROSSCOMPILING) +if(CMAKE_CROSSCOMPILING) + if(WIN32) + set(DCMTK_RUN_CTEST_SCRIPT "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/dcmtkCTestRunWine.cmake" CACHE INTERNAL "path to the CMake script for launching a unit test as a detached Wine process in the prepared wineprefix") + elseif(ANDROID) + set(DCMTK_RUN_CTEST_SCRIPT "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/dcmtkCTestRunAndroid.cmake" CACHE INTERNAL "path to the CMake script for launching a unit test via the android emulator") + else() + message(WARNING "Emulation for your target platform is not available, CTest will not be able to execute the unit tests!") + endif() +else() + set(DCMTK_RUN_CTEST_SCRIPT "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/dcmtkCTestRun.cmake" CACHE INTERNAL "path to the CMake script for launching a unit test") +endif() # Add a target to run the unit tests in exhaustive mode -ADD_CUSTOM_TARGET("test-exhaustive" +add_custom_target("test-exhaustive" COMMAND "${CMAKE_COMMAND}" "-DCONFIG=${DCMTK_CONFIG_GENERATOR_EXPRESSION}" "-P" "${DCMTK_SOURCE_DIR}/CMake/CTest/dcmtkCTestRunExhaustive.cmake" WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" @@ -79,26 +79,26 @@ ADD_CUSTOM_TARGET("test-exhaustive" #----------------------------------------------------------------------------- # Recurse into subdirectories -FOREACH(module config doxygen ${DCMTK_MODULES}) - ADD_SUBDIRECTORY(${module}) -ENDFOREACH(module) -INCLUDE(CMake/dcmtkAfterModules.cmake NO_POLICY_SCOPE) +foreach(module config doxygen ${DCMTK_MODULES}) + add_subdirectory(${module}) +endforeach() +include(CMake/dcmtkAfterModules.cmake NO_POLICY_SCOPE) #----------------------------------------------------------------------------- # Installation tasks #----------------------------------------------------------------------------- # Install global headers -INSTALL(FILES "${DCMTK_BINARY_DIR}/config/include/dcmtk/config/osconfig.h" +install(FILES "${DCMTK_BINARY_DIR}/config/include/dcmtk/config/osconfig.h" "${DCMTK_BINARY_DIR}/config/include/dcmtk/config/arith.h" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk/config" COMPONENT include) # Install DCMTK's general documentation files -INSTALL(FILES ANNOUNCE CHANGES COPYRIGHT CREDITS FAQ HISTORY VERSION +install(FILES ANNOUNCE CHANGES COPYRIGHT CREDITS FAQ HISTORY VERSION DESTINATION "${CMAKE_INSTALL_DOCDIR}" COMPONENT doc) -INSTALL(DIRECTORY docs/ DESTINATION "${CMAKE_INSTALL_DOCDIR}" +install(DIRECTORY docs/ DESTINATION "${CMAKE_INSTALL_DOCDIR}" COMPONENT doc FILES_MATCHING PATTERN "CHANGES.???") #----------------------------------------------------------------------------- @@ -114,79 +114,79 @@ INSTALL(DIRECTORY docs/ DESTINATION "${CMAKE_INSTALL_DOCDIR}" # under the main install dir (handled directly below). # Only create fully-fledged CMake export files if we have the related commands -INCLUDE(CMake/CheckCMakeCommandExists.cmake) -INCLUDE(CMakePackageConfigHelpers OPTIONAL) +include(CMake/CheckCMakeCommandExists.cmake) +include(CMakePackageConfigHelpers OPTIONAL) CHECK_CMAKE_COMMAND_EXISTS("CONFIGURE_PACKAGE_CONFIG_FILE") CHECK_CMAKE_COMMAND_EXISTS("WRITE_BASIC_PACKAGE_VERSION_FILE") -IF(HAVE_CONFIGURE_PACKAGE_CONFIG_FILE AND HAVE_WRITE_BASIC_PACKAGE_VERSION_FILE) +if(HAVE_CONFIGURE_PACKAGE_CONFIG_FILE AND HAVE_WRITE_BASIC_PACKAGE_VERSION_FILE) # Create and configure CMake export files - INCLUDE(CMake/GenerateCMakeExports.cmake) + include(CMake/GenerateCMakeExports.cmake) # ${DCMTK_INSTALL_CONFIG} and ${DCMTK_CONFIG_VERSION} are # defined within CMake/GenerateCMakeExports.cmake. # Install DCMTKTargets.cmake to install tree - INSTALL(EXPORT DCMTKTargets FILE DCMTKTargets.cmake + install(EXPORT DCMTKTargets FILE DCMTKTargets.cmake DESTINATION "${DCMTK_INSTALL_CMKDIR}" COMPONENT cmake) # Install DCMTKConfig.cmake and DCMTKConfigVersion.cmake - INSTALL(FILES "${DCMTK_INSTALL_CONFIG}" "${DCMTK_CONFIG_VERSION}" + install(FILES "${DCMTK_INSTALL_CONFIG}" "${DCMTK_CONFIG_VERSION}" DESTINATION "${DCMTK_INSTALL_CMKDIR}" COMPONENT cmake) -ELSE(HAVE_CONFIGURE_PACKAGE_CONFIG_FILE AND HAVE_WRITE_BASIC_PACKAGE_VERSION_FILE) +else() # Warning that we use old "configure_file" command - MESSAGE(STATUS "Warning: Using old CONFIGURE_FILE() mechanism to produce DCMTKConfig.cmake") + message(STATUS "Warning: Using old configure_file() mechanism to produce DCMTKConfig.cmake") # Actually configure file - CONFIGURE_FILE("${DCMTK_SOURCE_DIR}/CMake/DCMTKConfig.old_cmake.in" + configure_file("${DCMTK_SOURCE_DIR}/CMake/DCMTKConfig.old_cmake.in" "${DCMTK_BINARY_DIR}/DCMTKConfig.cmake" @ONLY) # Install DCMTKConfig.cmake and DCMTKConfigVersion.cmake - INSTALL(FILES "${DCMTK_BINARY_DIR}/DCMTKConfig.cmake" "${DCMTK_BINARY_DIR}/DCMTKConfigVersion.cmake" + install(FILES "${DCMTK_BINARY_DIR}/DCMTKConfig.cmake" "${DCMTK_BINARY_DIR}/DCMTKConfigVersion.cmake" DESTINATION "${DCMTK_INSTALL_CMKDIR}" COMPONENT cmake) -ENDIF(HAVE_CONFIGURE_PACKAGE_CONFIG_FILE AND HAVE_WRITE_BASIC_PACKAGE_VERSION_FILE) +endif() #----------------------------------------------------------------------------- # Configure files needed for running the unit tests and cleanup #----------------------------------------------------------------------------- -IF(CMAKE_CROSSCOMPILING) - IF(WIN32) - STRING(REPLACE ";" "${ENVIRONMENT_PATH_SEPARATOR}" DCMDICTPATH "${DCMTK_DICOM_DICTIONARIES}") - CONFIGURE_FILE("${DCMTK_SOURCE_DIR}/CMake/CTest/CTestCustomWine.cmake.in" +if(CMAKE_CROSSCOMPILING) + if(WIN32) + string(REPLACE ";" "${ENVIRONMENT_PATH_SEPARATOR}" DCMDICTPATH "${DCMTK_DICOM_DICTIONARIES}") + configure_file("${DCMTK_SOURCE_DIR}/CMake/CTest/CTestCustomWine.cmake.in" "${DCMTK_BINARY_DIR}/CTestCustom.cmake" ESCAPE_QUOTES @ONLY ) - CONFIGURE_FILE("${DCMTK_SOURCE_DIR}/CMake/CTest/dcmtkCTestRunWine.cmake.in" + configure_file("${DCMTK_SOURCE_DIR}/CMake/CTest/dcmtkCTestRunWine.cmake.in" "${DCMTK_RUN_CTEST_SCRIPT}" ESCAPE_QUOTES @ONLY ) - ELSEIF(ANDROID) + elseif(ANDROID) DCMTK_ANDROID_STOP_EMULATOR(DCMTK_ANDROID_EMULATOR_INSTANCE) # Prepare setting environment variable DCMDICTPATH - SET(DICTIONARIES ${DCMTK_DICOM_DICTIONARIES}) - LIST(GET DICTIONARIES 0 DCMDICTPATH) - LIST(REMOVE_AT DICTIONARIES 0) - GET_FILENAME_COMPONENT(DCMDICTPATH "${DCMDICTPATH}" NAME) - SET(DCMDICTPATH "${ANDROID_TEMPORARY_FILES_LOCATION}/${DCMDICTPATH}") - FOREACH(DICTIONARY ${DICTIONARIES}) - GET_FILENAME_COMPONENT(FILE "${DICTIONARY}" NAME) - SET(DCMDICTPATH "${DCMDICTPATH}:${ANDROID_TEMPORARY_FILES_LOCATION}/${FILE}") - ENDFOREACH() - CONFIGURE_FILE("${DCMTK_SOURCE_DIR}/CMake/CTest/CTestCustomAndroid.cmake.in" + set(DICTIONARIES ${DCMTK_DICOM_DICTIONARIES}) + list(GET DICTIONARIES 0 DCMDICTPATH) + list(REMOVE_AT DICTIONARIES 0) + get_filename_component(DCMDICTPATH "${DCMDICTPATH}" NAME) + set(DCMDICTPATH "${ANDROID_TEMPORARY_FILES_LOCATION}/${DCMDICTPATH}") + foreach(DICTIONARY ${DICTIONARIES}) + get_filename_component(FILE "${DICTIONARY}" NAME) + set(DCMDICTPATH "${DCMDICTPATH}:${ANDROID_TEMPORARY_FILES_LOCATION}/${FILE}") + endforeach() + configure_file("${DCMTK_SOURCE_DIR}/CMake/CTest/CTestCustomAndroid.cmake.in" "${DCMTK_BINARY_DIR}/CTestCustom.cmake" ESCAPE_QUOTES @ONLY ) - CONFIGURE_FILE("${DCMTK_SOURCE_DIR}/CMake/CTest/dcmtkCTestRunAndroid.cmake.in" + configure_file("${DCMTK_SOURCE_DIR}/CMake/CTest/dcmtkCTestRunAndroid.cmake.in" "${DCMTK_RUN_CTEST_SCRIPT}" ESCAPE_QUOTES @ONLY ) - ELSE() + else() # nothing to do - ENDIF() -ELSE(CMAKE_CROSSCOMPILING) - STRING(REPLACE ";" "${ENVIRONMENT_PATH_SEPARATOR}" DCMDICTPATH "${DCMTK_DICOM_DICTIONARIES}") - CONFIGURE_FILE("${DCMTK_SOURCE_DIR}/CMake/CTest/dcmtkCTestRun.cmake.in" + endif() +else() + string(REPLACE ";" "${ENVIRONMENT_PATH_SEPARATOR}" DCMDICTPATH "${DCMTK_DICOM_DICTIONARIES}") + configure_file("${DCMTK_SOURCE_DIR}/CMake/CTest/dcmtkCTestRun.cmake.in" "${DCMTK_RUN_CTEST_SCRIPT}" ESCAPE_QUOTES @ONLY ) -ENDIF(CMAKE_CROSSCOMPILING) +endif() diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt index 53579a1b5f..9578c35473 100644 --- a/config/CMakeLists.txt +++ b/config/CMakeLists.txt @@ -1,5 +1,5 @@ # declare project -PROJECT(config) +project(config) # recurse into subdirectories -ADD_SUBDIRECTORY(docs) +add_subdirectory(docs) diff --git a/config/docs/CMakeLists.txt b/config/docs/CMakeLists.txt index f2d42a1c26..c1b2ecd65e 100644 --- a/config/docs/CMakeLists.txt +++ b/config/docs/CMakeLists.txt @@ -1,2 +1,2 @@ # declare installation files -INSTALL(FILES config.txt dirstruc.txt envvars.txt macros.txt modules.txt DESTINATION "${CMAKE_INSTALL_DOCDIR}" COMPONENT doc) +install(FILES config.txt dirstruc.txt envvars.txt macros.txt modules.txt DESTINATION "${CMAKE_INSTALL_DOCDIR}" COMPONENT doc) diff --git a/dcmdata/CMakeLists.txt b/dcmdata/CMakeLists.txt index ded9ea97af..a526bebed4 100644 --- a/dcmdata/CMakeLists.txt +++ b/dcmdata/CMakeLists.txt @@ -1,10 +1,10 @@ # declare project -PROJECT(dcmdata) +project(dcmdata) # declare include directories which hold for all subdirectories -INCLUDE_DIRECTORIES("${dcmdata_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" ${ZLIB_INCDIR}) +include_directories("${dcmdata_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" ${ZLIB_INCDIR}) # recurse into subdirectories -FOREACH(SUBDIR libsrc libi2d apps include docs data tests) - ADD_SUBDIRECTORY(${SUBDIR}) -ENDFOREACH(SUBDIR) +foreach(SUBDIR libsrc libi2d apps include docs data tests) + add_subdirectory(${SUBDIR}) +endforeach() diff --git a/dcmdata/apps/CMakeLists.txt b/dcmdata/apps/CMakeLists.txt index 2f7ba60fd6..c46a8a774a 100644 --- a/dcmdata/apps/CMakeLists.txt +++ b/dcmdata/apps/CMakeLists.txt @@ -1,16 +1,16 @@ # declare additional include directories -INCLUDE_DIRECTORIES(${LIBXML_INCDIR}) +include_directories(${LIBXML_INCDIR}) # declare executables -FOREACH(PROGRAM dcm2xml dcmconv dcmcrle dcmdrle dcmdump dcmftest dcmgpdir dump2dcm xml2dcm pdf2dcm dcm2pdf img2dcm dcm2json) +foreach(PROGRAM dcm2xml dcmconv dcmcrle dcmdrle dcmdump dcmftest dcmgpdir dump2dcm xml2dcm pdf2dcm dcm2pdf img2dcm dcm2json) DCMTK_ADD_EXECUTABLE(${PROGRAM} ${PROGRAM}) -ENDFOREACH(PROGRAM) +endforeach() DCMTK_ADD_EXECUTABLE(dcmodify dcmodify mdfconen mdfdsman) # make sure executables are linked to the corresponding libraries -FOREACH(PROGRAM dcm2xml dcmconv dcmcrle dcmdrle dcmdump dcmgpdir dcmodify dump2dcm xml2dcm pdf2dcm dcm2pdf img2dcm dcm2json) +foreach(PROGRAM dcm2xml dcmconv dcmcrle dcmdrle dcmdump dcmgpdir dcmodify dump2dcm xml2dcm pdf2dcm dcm2pdf img2dcm dcm2json) DCMTK_TARGET_LINK_MODULES(${PROGRAM} dcmdata oflog ofstd) -ENDFOREACH(PROGRAM) +endforeach() DCMTK_TARGET_LINK_MODULES(dcmftest ofstd) DCMTK_TARGET_LINK_LIBRARIES(xml2dcm ${LIBXML_LIBS}) diff --git a/dcmdata/data/CMakeLists.txt b/dcmdata/data/CMakeLists.txt index 425c7e66d7..64ffba1fb0 100644 --- a/dcmdata/data/CMakeLists.txt +++ b/dcmdata/data/CMakeLists.txt @@ -1,8 +1,8 @@ # declare installation files -INSTALL(FILES dicom.dic acrnema.dic private.dic diconde.dic dcm2xml.dtd dumppat.txt SC.dump VLP.dump DESTINATION "${CMAKE_INSTALL_DATADIR}/dcmtk" COMPONENT data) +install(FILES dicom.dic acrnema.dic private.dic diconde.dic dcm2xml.dtd dumppat.txt SC.dump VLP.dump DESTINATION "${CMAKE_INSTALL_DATADIR}/dcmtk" COMPONENT data) # add paths to the dictionaries to a CMake variable for being used by the unit tests -SET(DCMTK_DICOM_DICTIONARIES +set(DCMTK_DICOM_DICTIONARIES "${CMAKE_CURRENT_SOURCE_DIR}/dicom.dic" "${CMAKE_CURRENT_SOURCE_DIR}/private.dic" CACHE INTERNAL "paths to the DICOM data dictionaries" diff --git a/dcmdata/docs/CMakeLists.txt b/dcmdata/docs/CMakeLists.txt index fe35ccc0fa..26d0ac5fc0 100644 --- a/dcmdata/docs/CMakeLists.txt +++ b/dcmdata/docs/CMakeLists.txt @@ -1,2 +1,2 @@ # declare installation files -INSTALL(FILES datadict.txt DESTINATION "${CMAKE_INSTALL_DOCDIR}" COMPONENT doc) +install(FILES datadict.txt DESTINATION "${CMAKE_INSTALL_DOCDIR}" COMPONENT doc) diff --git a/dcmdata/include/CMakeLists.txt b/dcmdata/include/CMakeLists.txt index da58ac0fff..ff2225d20d 100644 --- a/dcmdata/include/CMakeLists.txt +++ b/dcmdata/include/CMakeLists.txt @@ -1,2 +1,2 @@ # declare installation files -INSTALL(DIRECTORY dcmtk/dcmdata DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") +install(DIRECTORY dcmtk/dcmdata DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") diff --git a/dcmdata/libsrc/CMakeLists.txt b/dcmdata/libsrc/CMakeLists.txt index 7965ebcc50..5d7ecfda4d 100644 --- a/dcmdata/libsrc/CMakeLists.txt +++ b/dcmdata/libsrc/CMakeLists.txt @@ -1,6 +1,6 @@ # create library from source files -INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}") +include_directories("${CMAKE_CURRENT_SOURCE_DIR}") DCMTK_ADD_LIBRARY(dcmdata cmdlnarg dcbytstr dcchrstr dccodec dcdatset dcdatutl dcddirif dcdicdir dcdicent @@ -17,35 +17,35 @@ DCMTK_TARGET_LINK_MODULES(dcmdata ofstd oflog) DCMTK_TARGET_LINK_LIBRARIES(dcmdata ${ZLIB_LIBS}) # Various dictionary-related commands -SET(DICOMDIC "${dcmdata_SOURCE_DIR}/data/dicom.dic") -SET(PRIVATEDIC "${dcmdata_SOURCE_DIR}/data/private.dic") -SET(DICTIONARIES "${DICOMDIC}" "${PRIVATEDIC}") +set(DICOMDIC "${dcmdata_SOURCE_DIR}/data/dicom.dic") +set(PRIVATEDIC "${dcmdata_SOURCE_DIR}/data/private.dic") +set(DICTIONARIES "${DICOMDIC}" "${PRIVATEDIC}") -IF(BUILD_APPS) +if(BUILD_APPS) # don't use DCMTK_ADD_EXECUTABLE() since we don't want to install the files - ADD_EXECUTABLE(mkdictbi EXCLUDE_FROM_ALL mkdictbi dctagkey dcdicent dcdict dcvr dchashdi cmdlnarg dctypes) - ADD_EXECUTABLE(mkdeftag EXCLUDE_FROM_ALL mkdeftag dctagkey dcdicent dcdict dcvr dchashdi cmdlnarg dctypes) + add_executable(mkdictbi EXCLUDE_FROM_ALL mkdictbi dctagkey dcdicent dcdict dcvr dchashdi cmdlnarg dctypes) + add_executable(mkdeftag EXCLUDE_FROM_ALL mkdeftag dctagkey dcdicent dcdict dcvr dchashdi cmdlnarg dctypes) # workaround for Visual Studio to disable dll storage specifiers when linking directly into the executable. # this is needed since the built-in dictionary code is created by the tools below and thus those tools # statically link the few required dcmdata source files instead of linking to dcmdata as a whole. - SET_TARGET_PROPERTIES(mkdictbi mkdeftag PROPERTIES COMPILE_DEFINITIONS "DCMDATA_BUILD_DICTIONARY") -ENDIF(BUILD_APPS) + set_target_properties(mkdictbi mkdeftag PROPERTIES COMPILE_DEFINITIONS "DCMDATA_BUILD_DICTIONARY") +endif() DCMTK_TARGET_LINK_MODULES(mkdictbi ofstd oflog) DCMTK_TARGET_LINK_MODULES(mkdeftag ofstd oflog) -ADD_CUSTOM_TARGET(updatedeftag +add_custom_target(updatedeftag COMMAND mkdeftag -o "${dcmdata_SOURCE_DIR}/include/dcmtk/dcmdata/dcdeftag.h" ${DICTIONARIES} DEPENDS mkdeftag WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" COMMENT "Generate a new include file of defined tags") -ADD_CUSTOM_TARGET(updatebuiltindict +add_custom_target(updatebuiltindict COMMAND mkdictbi -o dcdictbi.cc ${DICTIONARIES} DEPENDS mkdictbi WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" COMMENT "Generate a builtin data dictionary") -ADD_CUSTOM_TARGET(mkvrscan +add_custom_target(mkvrscan COMMAND flex -8 --header-file=vrscanl.h --outfile=vrscanl.c vrscanl.l WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" COMMENT "Generate vrscanl.c and vrscanl.h") diff --git a/dcmfg/CMakeLists.txt b/dcmfg/CMakeLists.txt index 725d7916dc..bbd221b603 100644 --- a/dcmfg/CMakeLists.txt +++ b/dcmfg/CMakeLists.txt @@ -1,10 +1,10 @@ # declare project -PROJECT(dcmfg) +project(dcmfg) # declare include directories which hold for all subdirectories -INCLUDE_DIRECTORIES("${dcmfg_SOURCE_DIR}/include" "${dcmiod_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" ${ZLIB_INCDIR}) +include_directories("${dcmfg_SOURCE_DIR}/include" "${dcmiod_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" ${ZLIB_INCDIR}) # recurse into subdirectories -FOREACH(SUBDIR libsrc include) - ADD_SUBDIRECTORY(${SUBDIR}) -ENDFOREACH(SUBDIR) +foreach(SUBDIR libsrc include) + add_subdirectory(${SUBDIR}) +endforeach() diff --git a/dcmfg/include/CMakeLists.txt b/dcmfg/include/CMakeLists.txt index a8480bd5be..26c255ee4b 100644 --- a/dcmfg/include/CMakeLists.txt +++ b/dcmfg/include/CMakeLists.txt @@ -1,2 +1,2 @@ # declare installation files -INSTALL(DIRECTORY dcmtk/dcmfg DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") +install(DIRECTORY dcmtk/dcmfg DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") diff --git a/dcmimage/CMakeLists.txt b/dcmimage/CMakeLists.txt index 43640518b7..7a90faff99 100644 --- a/dcmimage/CMakeLists.txt +++ b/dcmimage/CMakeLists.txt @@ -1,10 +1,10 @@ # declare project -PROJECT(dcmimage) +project(dcmimage) # declare include directories which hold for all subdirectories -INCLUDE_DIRECTORIES("${dcmimage_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" "${dcmimgle_SOURCE_DIR}/include" ${ZLIB_INCDIR} ${LIBTIFF_INCDIR} ${LIBPNG_INCDIR}) +include_directories("${dcmimage_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" "${dcmimgle_SOURCE_DIR}/include" ${ZLIB_INCDIR} ${LIBTIFF_INCDIR} ${LIBPNG_INCDIR}) # recurse into subdirectories -FOREACH(SUBDIR libsrc apps include) - ADD_SUBDIRECTORY(${SUBDIR}) -ENDFOREACH(SUBDIR) +foreach(SUBDIR libsrc apps include) + add_subdirectory(${SUBDIR}) +endforeach() diff --git a/dcmimage/apps/CMakeLists.txt b/dcmimage/apps/CMakeLists.txt index ff27c849f4..7de7d6d9ca 100644 --- a/dcmimage/apps/CMakeLists.txt +++ b/dcmimage/apps/CMakeLists.txt @@ -1,9 +1,9 @@ # declare executables -FOREACH(PROGRAM dcm2pnm dcmquant dcmscale) +foreach(PROGRAM dcm2pnm dcmquant dcmscale) DCMTK_ADD_EXECUTABLE(${PROGRAM} ${PROGRAM}) -ENDFOREACH(PROGRAM) +endforeach() # make sure executables are linked to the corresponding libraries -FOREACH(PROGRAM dcm2pnm dcmquant dcmscale) +foreach(PROGRAM dcm2pnm dcmquant dcmscale) DCMTK_TARGET_LINK_MODULES(${PROGRAM} dcmimage dcmimgle dcmdata oflog ofstd) -ENDFOREACH(PROGRAM) +endforeach() diff --git a/dcmimage/include/CMakeLists.txt b/dcmimage/include/CMakeLists.txt index f0c0abaf82..4197eaaf13 100644 --- a/dcmimage/include/CMakeLists.txt +++ b/dcmimage/include/CMakeLists.txt @@ -1,2 +1,2 @@ # declare installation files -INSTALL(DIRECTORY dcmtk/dcmimage DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") +install(DIRECTORY dcmtk/dcmimage DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") diff --git a/dcmimgle/CMakeLists.txt b/dcmimgle/CMakeLists.txt index 80fc0ece55..d47992c68d 100644 --- a/dcmimgle/CMakeLists.txt +++ b/dcmimgle/CMakeLists.txt @@ -1,10 +1,10 @@ # declare project -PROJECT(dcmimgle) +project(dcmimgle) # declare include directories which hold for all subdirectories -INCLUDE_DIRECTORIES("${dcmimgle_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" ${ZLIB_INCDIR}) +include_directories("${dcmimgle_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" ${ZLIB_INCDIR}) # recurse into subdirectories -FOREACH(SUBDIR libsrc apps include data) - ADD_SUBDIRECTORY(${SUBDIR}) -ENDFOREACH(SUBDIR) +foreach(SUBDIR libsrc apps include data) + add_subdirectory(${SUBDIR}) +endforeach() diff --git a/dcmimgle/apps/CMakeLists.txt b/dcmimgle/apps/CMakeLists.txt index 8dd407c8f4..6909f5dc45 100644 --- a/dcmimgle/apps/CMakeLists.txt +++ b/dcmimgle/apps/CMakeLists.txt @@ -1,9 +1,9 @@ # declare executables -FOREACH(PROGRAM dcmdspfn dcod2lum dconvlum) +foreach(PROGRAM dcmdspfn dcod2lum dconvlum) DCMTK_ADD_EXECUTABLE(${PROGRAM} ${PROGRAM}) -ENDFOREACH(PROGRAM) +endforeach() # make sure executables are linked to the corresponding libraries -FOREACH(PROGRAM dcmdspfn dcod2lum dconvlum) +foreach(PROGRAM dcmdspfn dcod2lum dconvlum) DCMTK_TARGET_LINK_MODULES(${PROGRAM} dcmimgle dcmdata oflog ofstd) -ENDFOREACH(PROGRAM) +endforeach() diff --git a/dcmimgle/data/CMakeLists.txt b/dcmimgle/data/CMakeLists.txt index 22b3dd2c5f..7a02a71762 100644 --- a/dcmimgle/data/CMakeLists.txt +++ b/dcmimgle/data/CMakeLists.txt @@ -1,2 +1,2 @@ # declare installation files -INSTALL(FILES camera.lut monitor.lut printer.lut scanner.lut DESTINATION "${CMAKE_INSTALL_DATADIR}/dcmtk" COMPONENT data) +install(FILES camera.lut monitor.lut printer.lut scanner.lut DESTINATION "${CMAKE_INSTALL_DATADIR}/dcmtk" COMPONENT data) diff --git a/dcmimgle/include/CMakeLists.txt b/dcmimgle/include/CMakeLists.txt index 3f73b6180f..f961a2e040 100644 --- a/dcmimgle/include/CMakeLists.txt +++ b/dcmimgle/include/CMakeLists.txt @@ -1,2 +1,2 @@ # declare installation files -INSTALL(DIRECTORY dcmtk/dcmimgle DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") +install(DIRECTORY dcmtk/dcmimgle DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") diff --git a/dcmiod/CMakeLists.txt b/dcmiod/CMakeLists.txt index 07e691f480..046eb789b1 100644 --- a/dcmiod/CMakeLists.txt +++ b/dcmiod/CMakeLists.txt @@ -1,10 +1,10 @@ # declare project -PROJECT(dcmiod) +project(dcmiod) # declare include directories which hold for all subdirectories -INCLUDE_DIRECTORIES("${dcmiod_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" ${ZLIB_INCDIR}) +include_directories("${dcmiod_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" ${ZLIB_INCDIR}) # recurse into subdirectories -FOREACH(SUBDIR libsrc include tests) - ADD_SUBDIRECTORY(${SUBDIR}) -ENDFOREACH(SUBDIR) +foreach(SUBDIR libsrc include tests) + add_subdirectory(${SUBDIR}) +endforeach() diff --git a/dcmiod/include/CMakeLists.txt b/dcmiod/include/CMakeLists.txt index 868372d8a3..9ee1b5e52e 100644 --- a/dcmiod/include/CMakeLists.txt +++ b/dcmiod/include/CMakeLists.txt @@ -1,2 +1,2 @@ # declare installation files -INSTALL(DIRECTORY dcmtk/dcmiod DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") +install(DIRECTORY dcmtk/dcmiod DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") diff --git a/dcmjpeg/CMakeLists.txt b/dcmjpeg/CMakeLists.txt index 89b36ace18..0e995bf8cd 100644 --- a/dcmjpeg/CMakeLists.txt +++ b/dcmjpeg/CMakeLists.txt @@ -1,7 +1,7 @@ # declare project -PROJECT(dcmjpeg) +project(dcmjpeg) # recurse into subdirectories -FOREACH(SUBDIR libsrc libijg8 libijg12 libijg16 apps include) - ADD_SUBDIRECTORY(${SUBDIR}) -ENDFOREACH(SUBDIR) +foreach(SUBDIR libsrc libijg8 libijg12 libijg16 apps include) + add_subdirectory(${SUBDIR}) +endforeach() diff --git a/dcmjpeg/apps/CMakeLists.txt b/dcmjpeg/apps/CMakeLists.txt index 9a93bebfad..294a96f8a8 100644 --- a/dcmjpeg/apps/CMakeLists.txt +++ b/dcmjpeg/apps/CMakeLists.txt @@ -1,12 +1,12 @@ # declare additional include directories -INCLUDE_DIRECTORIES("${dcmjpeg_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" "${dcmimgle_SOURCE_DIR}/include" "${dcmimage_SOURCE_DIR}/include" ${ZLIB_INCDIR} ${LIBTIFF_INCDIR} ${LIBPNG_INCDIR}) +include_directories("${dcmjpeg_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" "${dcmimgle_SOURCE_DIR}/include" "${dcmimage_SOURCE_DIR}/include" ${ZLIB_INCDIR} ${LIBTIFF_INCDIR} ${LIBPNG_INCDIR}) # declare executables -FOREACH(PROGRAM dcmcjpeg dcmdjpeg dcmj2pnm dcmmkdir) +foreach(PROGRAM dcmcjpeg dcmdjpeg dcmj2pnm dcmmkdir) DCMTK_ADD_EXECUTABLE(${PROGRAM} ${PROGRAM}) -ENDFOREACH(PROGRAM) +endforeach() # make sure executables are linked to the corresponding libraries -FOREACH(PROGRAM dcmcjpeg dcmdjpeg dcmj2pnm dcmmkdir) +foreach(PROGRAM dcmcjpeg dcmdjpeg dcmj2pnm dcmmkdir) DCMTK_TARGET_LINK_MODULES(${PROGRAM} dcmjpeg ijg8 ijg12 ijg16 dcmimage dcmimgle dcmdata oflog ofstd) -ENDFOREACH(PROGRAM) +endforeach() diff --git a/dcmjpeg/include/CMakeLists.txt b/dcmjpeg/include/CMakeLists.txt index eb9d4a9620..1036689c0a 100644 --- a/dcmjpeg/include/CMakeLists.txt +++ b/dcmjpeg/include/CMakeLists.txt @@ -1,2 +1,2 @@ # declare installation files -INSTALL(DIRECTORY dcmtk/dcmjpeg DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") +install(DIRECTORY dcmtk/dcmjpeg DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") diff --git a/dcmjpeg/libsrc/CMakeLists.txt b/dcmjpeg/libsrc/CMakeLists.txt index 8321c681ee..a4a8a60b8a 100644 --- a/dcmjpeg/libsrc/CMakeLists.txt +++ b/dcmjpeg/libsrc/CMakeLists.txt @@ -1,5 +1,5 @@ # declare additional include directories -INCLUDE_DIRECTORIES("${dcmjpeg_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" "${dcmimgle_SOURCE_DIR}/include" "${dcmimage_SOURCE_DIR}/include" "${dcmjpeg_SOURCE_DIR}/libijg8" "${dcmjpeg_SOURCE_DIR}/libijg12" "${dcmjpeg_SOURCE_DIR}/libijg16" ${ZLIB_INCDIR}) +include_directories("${dcmjpeg_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" "${dcmimgle_SOURCE_DIR}/include" "${dcmimage_SOURCE_DIR}/include" "${dcmjpeg_SOURCE_DIR}/libijg8" "${dcmjpeg_SOURCE_DIR}/libijg12" "${dcmjpeg_SOURCE_DIR}/libijg16" ${ZLIB_INCDIR}) # create library from source files DCMTK_ADD_LIBRARY(dcmjpeg ddpiimpl dipijpeg djcodecd djcodece djcparam djdecbas djdecext djdeclol djdecode djdecpro djdecsps djdecsv1 djdijg12 djdijg8 djdijg16 djeijg12 djeijg8 djeijg16 djencbas djencext djenclol djencode djencpro djencsps djencsv1 djrplol djrploss djutils) diff --git a/dcmjpls/CMakeLists.txt b/dcmjpls/CMakeLists.txt index e114663776..c8a05a7a99 100644 --- a/dcmjpls/CMakeLists.txt +++ b/dcmjpls/CMakeLists.txt @@ -1,7 +1,7 @@ # declare project -PROJECT(dcmjpls) +project(dcmjpls) # recurse into subdirectories -FOREACH(SUBDIR libsrc libcharls apps include) - ADD_SUBDIRECTORY(${SUBDIR}) -ENDFOREACH(SUBDIR) +foreach(SUBDIR libsrc libcharls apps include) + add_subdirectory(${SUBDIR}) +endforeach() diff --git a/dcmjpls/apps/CMakeLists.txt b/dcmjpls/apps/CMakeLists.txt index 14d8756966..2a9a4526ee 100644 --- a/dcmjpls/apps/CMakeLists.txt +++ b/dcmjpls/apps/CMakeLists.txt @@ -1,12 +1,12 @@ # declare additional include directories -INCLUDE_DIRECTORIES("${dcmjpls_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" "${dcmimgle_SOURCE_DIR}/include" "${dcmimage_SOURCE_DIR}/include" ${ZLIB_INCDIR} ${LIBTIFF_INCDIR} ${LIBPNG_INCDIR}) +include_directories("${dcmjpls_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" "${dcmimgle_SOURCE_DIR}/include" "${dcmimage_SOURCE_DIR}/include" ${ZLIB_INCDIR} ${LIBTIFF_INCDIR} ${LIBPNG_INCDIR}) # declare executables -FOREACH(PROGRAM dcmcjpls dcmdjpls dcml2pnm) +foreach(PROGRAM dcmcjpls dcmdjpls dcml2pnm) DCMTK_ADD_EXECUTABLE(${PROGRAM} ${PROGRAM}) -ENDFOREACH(PROGRAM) +endforeach() # make sure executables are linked to the corresponding libraries -FOREACH(PROGRAM dcmcjpls dcmdjpls dcml2pnm) +foreach(PROGRAM dcmcjpls dcmdjpls dcml2pnm) DCMTK_TARGET_LINK_MODULES(${PROGRAM} dcmjpls charls dcmimage dcmimgle dcmdata oflog ofstd ofstd) -ENDFOREACH(PROGRAM) +endforeach() diff --git a/dcmjpls/include/CMakeLists.txt b/dcmjpls/include/CMakeLists.txt index 936c7558f3..1f37cb08ab 100644 --- a/dcmjpls/include/CMakeLists.txt +++ b/dcmjpls/include/CMakeLists.txt @@ -1,2 +1,2 @@ # declare installation files -INSTALL(DIRECTORY dcmtk/dcmjpls DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") +install(DIRECTORY dcmtk/dcmjpls DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") diff --git a/dcmjpls/libcharls/CMakeLists.txt b/dcmjpls/libcharls/CMakeLists.txt index efd52ff5f2..0c5b14335c 100644 --- a/dcmjpls/libcharls/CMakeLists.txt +++ b/dcmjpls/libcharls/CMakeLists.txt @@ -1,5 +1,5 @@ # declare additional include directories -INCLUDE_DIRECTORIES("${dcmjpls_SOURCE_DIR}/libcharls" "${ofstd_SOURCE_DIR}/include") +include_directories("${dcmjpls_SOURCE_DIR}/libcharls" "${ofstd_SOURCE_DIR}/include") # create library from source files DCMTK_ADD_LIBRARY(charls header intrface jpegls) diff --git a/dcmjpls/libsrc/CMakeLists.txt b/dcmjpls/libsrc/CMakeLists.txt index 7e84f4dc50..314face74b 100644 --- a/dcmjpls/libsrc/CMakeLists.txt +++ b/dcmjpls/libsrc/CMakeLists.txt @@ -1,5 +1,5 @@ # declare additional include directories -INCLUDE_DIRECTORIES("${dcmjpls_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" "${dcmimgle_SOURCE_DIR}/include" "${dcmimage_SOURCE_DIR}/include" "${dcmjpls_SOURCE_DIR}/libcharls" ${ZLIB_INCDIR}) +include_directories("${dcmjpls_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" "${dcmimgle_SOURCE_DIR}/include" "${dcmimage_SOURCE_DIR}/include" "${dcmjpls_SOURCE_DIR}/libcharls" ${ZLIB_INCDIR}) # create library from source files DCMTK_ADD_LIBRARY(dcmjpls djcparam djdecode djencode djrparam djcodecd djutils djcodece) diff --git a/dcmnet/CMakeLists.txt b/dcmnet/CMakeLists.txt index 98730557c3..4fb4d4ddd7 100644 --- a/dcmnet/CMakeLists.txt +++ b/dcmnet/CMakeLists.txt @@ -1,10 +1,10 @@ # declare project -PROJECT(dcmnet) +project(dcmnet) # declare include directories which hold for all subdirectories -INCLUDE_DIRECTORIES("${dcmnet_SOURCE_DIR}/include" "${dcmtls_SOURCE_DIR}/include" ${OPENSSL_INCDIR} "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" ${ZLIB_INCDIR}) +include_directories("${dcmnet_SOURCE_DIR}/include" "${dcmtls_SOURCE_DIR}/include" ${OPENSSL_INCDIR} "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" ${ZLIB_INCDIR}) # recurse into subdirectories -FOREACH(SUBDIR libsrc apps include docs etc tests) - ADD_SUBDIRECTORY(${SUBDIR}) -ENDFOREACH(SUBDIR) +foreach(SUBDIR libsrc apps include docs etc tests) + add_subdirectory(${SUBDIR}) +endforeach() diff --git a/dcmnet/apps/CMakeLists.txt b/dcmnet/apps/CMakeLists.txt index d35448abff..aa0ff8b250 100644 --- a/dcmnet/apps/CMakeLists.txt +++ b/dcmnet/apps/CMakeLists.txt @@ -1,37 +1,37 @@ # declare additional include directories needed for compression support -INCLUDE_DIRECTORIES("${dcmjpls_SOURCE_DIR}/include" "${dcmjpeg_SOURCE_DIR}/include" "${dcmimage_SOURCE_DIR}/include" "${dcmimgle_SOURCE_DIR}/include") +include_directories("${dcmjpls_SOURCE_DIR}/include" "${dcmjpeg_SOURCE_DIR}/include" "${dcmimage_SOURCE_DIR}/include" "${dcmimgle_SOURCE_DIR}/include") # declare executables -FOREACH(PROGRAM dcmrecv dcmsend echoscu findscu getscu movescu storescp storescu termscu) +foreach(PROGRAM dcmrecv dcmsend echoscu findscu getscu movescu storescp storescu termscu) DCMTK_ADD_EXECUTABLE(${PROGRAM} ${PROGRAM}) -ENDFOREACH(PROGRAM) +endforeach() # declare installation files -IF(WITH_OPENSSL) - IF(WIN32) - INSTALL(DIRECTORY "${OPENSSL_BINDIR}/" +if(WITH_OPENSSL) + if(WIN32) + install(DIRECTORY "${OPENSSL_BINDIR}/" DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin CONFIGURATIONS Release MinSizeRel FILES_MATCHING REGEX "dcmtk(eay|crypto|ssl).*\\.dll" REGEX "dcmtk(eay|crypto|ssl)_d.*\\.dll" EXCLUDE ) - INSTALL(DIRECTORY "${OPENSSL_BINDIR}/" + install(DIRECTORY "${OPENSSL_BINDIR}/" DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin CONFIGURATIONS Debug RelWithDebInfo FILES_MATCHING REGEX "dcmtk(eay|crypto|ssl)_d.*\\.dll" ) - ENDIF(WIN32) -ENDIF(WITH_OPENSSL) + endif() +endif() # make sure executables are linked to the corresponding libraries -FOREACH(PROGRAM dcmrecv dcmsend echoscu findscu getscu movescu storescp storescu termscu) +foreach(PROGRAM dcmrecv dcmsend echoscu findscu getscu movescu storescp storescu termscu) DCMTK_TARGET_LINK_MODULES(${PROGRAM} dcmnet dcmdata oflog ofstd) -ENDFOREACH(PROGRAM) -FOREACH(PROGRAM echoscu findscu storescp storescu) +endforeach() +foreach(PROGRAM echoscu findscu storescp storescu) DCMTK_TARGET_LINK_MODULES(${PROGRAM} dcmtls) -ENDFOREACH(PROGRAM) +endforeach() # uncomment the following line if "storescu" is compiled with ON_THE_FLY_COMPRESSION defined #DCMTK_TARGET_LINK_MODULES(storescu dcmjpls dcmjpeg dcmimage) diff --git a/dcmnet/docs/CMakeLists.txt b/dcmnet/docs/CMakeLists.txt index 3c49b4259f..176ffbb05d 100644 --- a/dcmnet/docs/CMakeLists.txt +++ b/dcmnet/docs/CMakeLists.txt @@ -1,2 +1,2 @@ # declare installation files -INSTALL(FILES asconfig.txt testing.txt DESTINATION "${CMAKE_INSTALL_DOCDIR}" COMPONENT doc) +install(FILES asconfig.txt testing.txt DESTINATION "${CMAKE_INSTALL_DOCDIR}" COMPONENT doc) diff --git a/dcmnet/etc/CMakeLists.txt b/dcmnet/etc/CMakeLists.txt index a46bec8f00..29335c4588 100644 --- a/dcmnet/etc/CMakeLists.txt +++ b/dcmnet/etc/CMakeLists.txt @@ -1,2 +1,2 @@ # declare installation files -INSTALL(FILES storescp.cfg storescu.cfg DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/dcmtk" COMPONENT etc) +install(FILES storescp.cfg storescu.cfg DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/dcmtk" COMPONENT etc) diff --git a/dcmnet/include/CMakeLists.txt b/dcmnet/include/CMakeLists.txt index d5b2295ebf..2b0d1c4c09 100644 --- a/dcmnet/include/CMakeLists.txt +++ b/dcmnet/include/CMakeLists.txt @@ -1,2 +1,2 @@ # declare installation files -INSTALL(DIRECTORY dcmtk/dcmnet DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") +install(DIRECTORY dcmtk/dcmnet DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") diff --git a/dcmpmap/CMakeLists.txt b/dcmpmap/CMakeLists.txt index ff7e16fceb..f45a460545 100644 --- a/dcmpmap/CMakeLists.txt +++ b/dcmpmap/CMakeLists.txt @@ -1,10 +1,10 @@ # declare project -PROJECT(dcmpmaps) +project(dcmpmaps) # declare include directories which hold for all subdirectories -INCLUDE_DIRECTORIES("${dcmpmaps_SOURCE_DIR}/include" "${dcmfg_SOURCE_DIR}/include" "${dcmiod_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" ${ZLIB_INCDIR}) +include_directories("${dcmpmaps_SOURCE_DIR}/include" "${dcmfg_SOURCE_DIR}/include" "${dcmiod_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" ${ZLIB_INCDIR}) # recurse into subdirectories -FOREACH(SUBDIR libsrc include) - ADD_SUBDIRECTORY(${SUBDIR}) -ENDFOREACH(SUBDIR) +foreach(SUBDIR libsrc include) + add_subdirectory(${SUBDIR}) +endforeach() diff --git a/dcmpmap/include/CMakeLists.txt b/dcmpmap/include/CMakeLists.txt index 5aeebd50ce..5fd6801583 100644 --- a/dcmpmap/include/CMakeLists.txt +++ b/dcmpmap/include/CMakeLists.txt @@ -1,2 +1,2 @@ # declare installation files -INSTALL(DIRECTORY dcmtk/dcmpmap DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") +install(DIRECTORY dcmtk/dcmpmap DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") diff --git a/dcmpstat/CMakeLists.txt b/dcmpstat/CMakeLists.txt index 994da8b751..340293b7c5 100644 --- a/dcmpstat/CMakeLists.txt +++ b/dcmpstat/CMakeLists.txt @@ -1,10 +1,10 @@ # declare project -PROJECT(dcmpstat) +project(dcmpstat) # declare include directories which hold for all subdirectories -INCLUDE_DIRECTORIES("${dcmpstat_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" "${dcmnet_SOURCE_DIR}/include" "${dcmimgle_SOURCE_DIR}/include" "${dcmqrdb_SOURCE_DIR}/include" "${dcmsr_SOURCE_DIR}/include" "${dcmsign_SOURCE_DIR}/include" "${dcmtls_SOURCE_DIR}/include" ${ZLIB_INCDIR} ${OPENSSL_INCDIR}) +include_directories("${dcmpstat_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" "${dcmnet_SOURCE_DIR}/include" "${dcmimgle_SOURCE_DIR}/include" "${dcmqrdb_SOURCE_DIR}/include" "${dcmsr_SOURCE_DIR}/include" "${dcmsign_SOURCE_DIR}/include" "${dcmtls_SOURCE_DIR}/include" ${ZLIB_INCDIR} ${OPENSSL_INCDIR}) # recurse into subdirectories -FOREACH(SUBDIR libsrc apps include data etc tests) - ADD_SUBDIRECTORY(${SUBDIR}) -ENDFOREACH(SUBDIR) +foreach(SUBDIR libsrc apps include data etc tests) + add_subdirectory(${SUBDIR}) +endforeach() diff --git a/dcmpstat/apps/CMakeLists.txt b/dcmpstat/apps/CMakeLists.txt index 4bc6024d99..776e462220 100644 --- a/dcmpstat/apps/CMakeLists.txt +++ b/dcmpstat/apps/CMakeLists.txt @@ -1,16 +1,16 @@ # declare additional include directories -INCLUDE_DIRECTORIES(${dcmtls_SOURCE_DIR}/include ${LIBXML_INCDIR}) +include_directories(${dcmtls_SOURCE_DIR}/include ${LIBXML_INCDIR}) # declare executables -FOREACH(PROGRAM dcmmkcrv dcmmklut dcmp2pgm dcmprscp dcmprscu dcmpschk dcmpsmk dcmpsprt dcmpsrcv dcmpssnd) +foreach(PROGRAM dcmmkcrv dcmmklut dcmp2pgm dcmprscp dcmprscu dcmpschk dcmpsmk dcmpsprt dcmpsrcv dcmpssnd) DCMTK_ADD_EXECUTABLE(${PROGRAM} ${PROGRAM}) -ENDFOREACH(PROGRAM) +endforeach() # make sure executables are linked to the corresponding libraries -FOREACH(PROGRAM dcmp2pgm dcmprscp dcmprscu dcmpsmk dcmpschk dcmpsprt dcmpsrcv dcmpssnd) +foreach(PROGRAM dcmp2pgm dcmprscp dcmprscu dcmpsmk dcmpschk dcmpsprt dcmpsrcv dcmpssnd) DCMTK_TARGET_LINK_MODULES(${PROGRAM} dcmpstat dcmdsig dcmsr dcmimage dcmimgle dcmqrdb dcmnet dcmtls dcmdata oflog ofstd) -ENDFOREACH(PROGRAM) +endforeach() -FOREACH(PROGRAM dcmmkcrv dcmmklut) +foreach(PROGRAM dcmmkcrv dcmmklut) DCMTK_TARGET_LINK_MODULES(${PROGRAM} dcmdsig dcmsr dcmimage dcmimgle dcmdata oflog ofstd) -ENDFOREACH(PROGRAM) +endforeach() diff --git a/dcmpstat/data/CMakeLists.txt b/dcmpstat/data/CMakeLists.txt index 216158d6f6..9a10736aec 100644 --- a/dcmpstat/data/CMakeLists.txt +++ b/dcmpstat/data/CMakeLists.txt @@ -1,2 +1,2 @@ # declare installation files -INSTALL(FILES philips.lut DESTINATION "${CMAKE_INSTALL_DATADIR}/dcmtk" COMPONENT data) +install(FILES philips.lut DESTINATION "${CMAKE_INSTALL_DATADIR}/dcmtk" COMPONENT data) diff --git a/dcmpstat/etc/CMakeLists.txt b/dcmpstat/etc/CMakeLists.txt index d48c648038..9f4bd0b12c 100644 --- a/dcmpstat/etc/CMakeLists.txt +++ b/dcmpstat/etc/CMakeLists.txt @@ -1,2 +1,2 @@ # declare installation files -INSTALL(FILES dcmpstat.cfg printers.cfg DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/dcmtk" COMPONENT etc) +install(FILES dcmpstat.cfg printers.cfg DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/dcmtk" COMPONENT etc) diff --git a/dcmpstat/include/CMakeLists.txt b/dcmpstat/include/CMakeLists.txt index ee3b58ca33..9bf65f6737 100644 --- a/dcmpstat/include/CMakeLists.txt +++ b/dcmpstat/include/CMakeLists.txt @@ -1,2 +1,2 @@ # declare installation files -INSTALL(DIRECTORY dcmtk/dcmpstat DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") +install(DIRECTORY dcmtk/dcmpstat DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") diff --git a/dcmqrdb/CMakeLists.txt b/dcmqrdb/CMakeLists.txt index 0c0d3aefbb..b083d01aef 100644 --- a/dcmqrdb/CMakeLists.txt +++ b/dcmqrdb/CMakeLists.txt @@ -1,10 +1,10 @@ # declare project -PROJECT(dcmqrdb) +project(dcmqrdb) # declare include directories which hold for all subdirectories -INCLUDE_DIRECTORIES("${dcmqrdb_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" "${dcmnet_SOURCE_DIR}/include" ${ZLIB_INCDIR}) +include_directories("${dcmqrdb_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" "${dcmnet_SOURCE_DIR}/include" ${ZLIB_INCDIR}) # recurse into subdirectories -FOREACH(SUBDIR libsrc apps include docs etc) - ADD_SUBDIRECTORY(${SUBDIR}) -ENDFOREACH(SUBDIR) +foreach(SUBDIR libsrc apps include docs etc) + add_subdirectory(${SUBDIR}) +endforeach() diff --git a/dcmqrdb/apps/CMakeLists.txt b/dcmqrdb/apps/CMakeLists.txt index 43b593617e..7dc4b3c452 100644 --- a/dcmqrdb/apps/CMakeLists.txt +++ b/dcmqrdb/apps/CMakeLists.txt @@ -1,9 +1,9 @@ # declare executables -FOREACH(PROGRAM dcmqrscp dcmqridx dcmqrti) +foreach(PROGRAM dcmqrscp dcmqridx dcmqrti) DCMTK_ADD_EXECUTABLE(${PROGRAM} ${PROGRAM}) -ENDFOREACH(PROGRAM) +endforeach() # make sure executables are linked to the corresponding libraries -FOREACH(PROGRAM dcmqrscp dcmqridx dcmqrti) +foreach(PROGRAM dcmqrscp dcmqridx dcmqrti) DCMTK_TARGET_LINK_MODULES(${PROGRAM} dcmqrdb dcmnet dcmdata oflog ofstd) -ENDFOREACH(PROGRAM) +endforeach() diff --git a/dcmqrdb/docs/CMakeLists.txt b/dcmqrdb/docs/CMakeLists.txt index 06cbf5f55b..ec15335fd1 100644 --- a/dcmqrdb/docs/CMakeLists.txt +++ b/dcmqrdb/docs/CMakeLists.txt @@ -1,2 +1,2 @@ # declare installation files -INSTALL(FILES dcmqrcnf.txt dcmqrset.txt DESTINATION "${CMAKE_INSTALL_DOCDIR}" COMPONENT doc) +install(FILES dcmqrcnf.txt dcmqrset.txt DESTINATION "${CMAKE_INSTALL_DOCDIR}" COMPONENT doc) diff --git a/dcmqrdb/etc/CMakeLists.txt b/dcmqrdb/etc/CMakeLists.txt index 47ba906686..f64f09a795 100644 --- a/dcmqrdb/etc/CMakeLists.txt +++ b/dcmqrdb/etc/CMakeLists.txt @@ -1,2 +1,2 @@ # declare installation files -INSTALL(FILES dcmqrscp.cfg DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/dcmtk" COMPONENT etc) +install(FILES dcmqrscp.cfg DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/dcmtk" COMPONENT etc) diff --git a/dcmqrdb/include/CMakeLists.txt b/dcmqrdb/include/CMakeLists.txt index 2d82575ea6..567088e46d 100644 --- a/dcmqrdb/include/CMakeLists.txt +++ b/dcmqrdb/include/CMakeLists.txt @@ -1,2 +1,2 @@ # declare installation files -INSTALL(DIRECTORY dcmtk/dcmqrdb DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") +install(DIRECTORY dcmtk/dcmqrdb DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") diff --git a/dcmrt/CMakeLists.txt b/dcmrt/CMakeLists.txt index 1f387384b8..fe09c8900b 100644 --- a/dcmrt/CMakeLists.txt +++ b/dcmrt/CMakeLists.txt @@ -1,10 +1,10 @@ # declare project -PROJECT(dcmrt) +project(dcmrt) # declare include directories which hold for all subdirectories -INCLUDE_DIRECTORIES("${dcmrt_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" ${ZLIB_INCDIR}) +include_directories("${dcmrt_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" ${ZLIB_INCDIR}) # recurse into subdirectories -FOREACH(SUBDIR libsrc apps tests include) - ADD_SUBDIRECTORY(${SUBDIR}) -ENDFOREACH(SUBDIR) +foreach(SUBDIR libsrc apps tests include) + add_subdirectory(${SUBDIR}) +endforeach() diff --git a/dcmrt/include/CMakeLists.txt b/dcmrt/include/CMakeLists.txt index 40d36015d0..0370f56ecc 100644 --- a/dcmrt/include/CMakeLists.txt +++ b/dcmrt/include/CMakeLists.txt @@ -1,2 +1,2 @@ # declare installation files -INSTALL(DIRECTORY dcmtk/dcmrt DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") +install(DIRECTORY dcmtk/dcmrt DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") diff --git a/dcmseg/CMakeLists.txt b/dcmseg/CMakeLists.txt index 7d32432def..37bd9d6c25 100644 --- a/dcmseg/CMakeLists.txt +++ b/dcmseg/CMakeLists.txt @@ -1,10 +1,10 @@ # declare project -PROJECT(dcmseg) +project(dcmseg) # declare include directories which hold for all subdirectories -INCLUDE_DIRECTORIES("${dcmseg_SOURCE_DIR}/include" "${dcmfg_SOURCE_DIR}/include" "${dcmiod_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" ${ZLIB_INCDIR}) +include_directories("${dcmseg_SOURCE_DIR}/include" "${dcmfg_SOURCE_DIR}/include" "${dcmiod_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" ${ZLIB_INCDIR}) # recurse into subdirectories -FOREACH(SUBDIR libsrc include tests) - ADD_SUBDIRECTORY(${SUBDIR}) -ENDFOREACH(SUBDIR) +foreach(SUBDIR libsrc include tests) + add_subdirectory(${SUBDIR}) +endforeach() diff --git a/dcmseg/include/CMakeLists.txt b/dcmseg/include/CMakeLists.txt index b21136265c..3dd090ae59 100644 --- a/dcmseg/include/CMakeLists.txt +++ b/dcmseg/include/CMakeLists.txt @@ -1,2 +1,2 @@ # declare installation files -INSTALL(DIRECTORY dcmtk/dcmseg DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") +install(DIRECTORY dcmtk/dcmseg DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") diff --git a/dcmsign/CMakeLists.txt b/dcmsign/CMakeLists.txt index 9bda43f158..68205cbc29 100644 --- a/dcmsign/CMakeLists.txt +++ b/dcmsign/CMakeLists.txt @@ -1,10 +1,10 @@ # declare project -PROJECT(dcmsign) +project(dcmsign) # declare include directories which hold for all subdirectories -INCLUDE_DIRECTORIES("${dcmsign_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" ${ZLIB_INCDIR} ${OPENSSL_INCDIR}) +include_directories("${dcmsign_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" ${ZLIB_INCDIR} ${OPENSSL_INCDIR}) # recurse into subdirectories -FOREACH(SUBDIR libsrc apps include) - ADD_SUBDIRECTORY(${SUBDIR}) -ENDFOREACH(SUBDIR) +foreach(SUBDIR libsrc apps include) + add_subdirectory(${SUBDIR}) +endforeach() diff --git a/dcmsign/include/CMakeLists.txt b/dcmsign/include/CMakeLists.txt index 5dd8b17239..c31469545e 100644 --- a/dcmsign/include/CMakeLists.txt +++ b/dcmsign/include/CMakeLists.txt @@ -1,2 +1,2 @@ # declare installation files -INSTALL(DIRECTORY dcmtk/dcmsign DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") +install(DIRECTORY dcmtk/dcmsign DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") diff --git a/dcmsr/CMakeLists.txt b/dcmsr/CMakeLists.txt index d4080c63d1..96fb98be44 100644 --- a/dcmsr/CMakeLists.txt +++ b/dcmsr/CMakeLists.txt @@ -1,10 +1,10 @@ # declare project -PROJECT(dcmsr) +project(dcmsr) # declare include directories which hold for all subdirectories -INCLUDE_DIRECTORIES("${dcmsr_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" "${dcmimgle_SOURCE_DIR}/include" "${dcmimage_SOURCE_DIR}/include" ${ZLIB_INCDIR} ${LIBXML_INCDIR}) +include_directories("${dcmsr_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" "${dcmimgle_SOURCE_DIR}/include" "${dcmimage_SOURCE_DIR}/include" ${ZLIB_INCDIR} ${LIBXML_INCDIR}) # recurse into subdirectories -FOREACH(SUBDIR libsrc libcmr apps tests include data) - ADD_SUBDIRECTORY(${SUBDIR}) -ENDFOREACH(SUBDIR) +foreach(SUBDIR libsrc libcmr apps tests include data) + add_subdirectory(${SUBDIR}) +endforeach() diff --git a/dcmsr/apps/CMakeLists.txt b/dcmsr/apps/CMakeLists.txt index e3e0f03b56..c0224bfa51 100644 --- a/dcmsr/apps/CMakeLists.txt +++ b/dcmsr/apps/CMakeLists.txt @@ -1,9 +1,9 @@ # declare executables -FOREACH(PROGRAM dsr2html dsr2xml dsrdump xml2dsr) +foreach(PROGRAM dsr2html dsr2xml dsrdump xml2dsr) DCMTK_ADD_EXECUTABLE(${PROGRAM} ${PROGRAM}) -ENDFOREACH(PROGRAM) +endforeach() # make sure executables are linked to the corresponding libraries -FOREACH(PROGRAM dsr2html dsr2xml dsrdump xml2dsr) +foreach(PROGRAM dsr2html dsr2xml dsrdump xml2dsr) DCMTK_TARGET_LINK_MODULES(${PROGRAM} dcmsr dcmimage dcmimgle dcmdata oflog ofstd) -ENDFOREACH(PROGRAM) +endforeach() diff --git a/dcmsr/data/CMakeLists.txt b/dcmsr/data/CMakeLists.txt index ea1787575c..e6c175febb 100644 --- a/dcmsr/data/CMakeLists.txt +++ b/dcmsr/data/CMakeLists.txt @@ -1,2 +1,2 @@ # declare installation files -INSTALL(FILES dsr2xml.xsd report.css reportx.css DESTINATION "${CMAKE_INSTALL_DATADIR}/dcmtk" COMPONENT data) +install(FILES dsr2xml.xsd report.css reportx.css DESTINATION "${CMAKE_INSTALL_DATADIR}/dcmtk" COMPONENT data) diff --git a/dcmsr/include/CMakeLists.txt b/dcmsr/include/CMakeLists.txt index b261ff37d5..436f36d8f5 100644 --- a/dcmsr/include/CMakeLists.txt +++ b/dcmsr/include/CMakeLists.txt @@ -1,2 +1,2 @@ # declare installation files -INSTALL(DIRECTORY dcmtk/dcmsr DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") +install(DIRECTORY dcmtk/dcmsr DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") diff --git a/dcmtls/CMakeLists.txt b/dcmtls/CMakeLists.txt index 85ab8e8860..d40200d541 100644 --- a/dcmtls/CMakeLists.txt +++ b/dcmtls/CMakeLists.txt @@ -1,10 +1,10 @@ # declare project -PROJECT(dcmtls) +project(dcmtls) # declare include directories which hold for all subdirectories -INCLUDE_DIRECTORIES("${dcmtls_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" "${dcmnet_SOURCE_DIR}/include" ${ZLIB_INCDIR} ${OPENSSL_INCDIR}) +include_directories("${dcmtls_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" "${dcmnet_SOURCE_DIR}/include" ${ZLIB_INCDIR} ${OPENSSL_INCDIR}) # recurse into subdirectories -FOREACH(SUBDIR libsrc include docs) - ADD_SUBDIRECTORY(${SUBDIR}) -ENDFOREACH(SUBDIR) +foreach(SUBDIR libsrc include docs) + add_subdirectory(${SUBDIR}) +endforeach() diff --git a/dcmtls/docs/CMakeLists.txt b/dcmtls/docs/CMakeLists.txt index 11da0d4d76..102e17fb90 100644 --- a/dcmtls/docs/CMakeLists.txt +++ b/dcmtls/docs/CMakeLists.txt @@ -1,2 +1,2 @@ # declare installation files -INSTALL(FILES ciphers.txt randseed.txt certstor.txt DESTINATION "${CMAKE_INSTALL_DOCDIR}" COMPONENT doc) +install(FILES ciphers.txt randseed.txt certstor.txt DESTINATION "${CMAKE_INSTALL_DOCDIR}" COMPONENT doc) diff --git a/dcmtls/include/CMakeLists.txt b/dcmtls/include/CMakeLists.txt index 316fa4f621..9f0120d81f 100644 --- a/dcmtls/include/CMakeLists.txt +++ b/dcmtls/include/CMakeLists.txt @@ -1,2 +1,2 @@ # declare installation files -INSTALL(DIRECTORY dcmtk/dcmtls DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") +install(DIRECTORY dcmtk/dcmtls DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") diff --git a/dcmtract/CMakeLists.txt b/dcmtract/CMakeLists.txt index a178cf187b..504b52090b 100644 --- a/dcmtract/CMakeLists.txt +++ b/dcmtract/CMakeLists.txt @@ -1,10 +1,10 @@ # declare project -PROJECT(dcmtract) +project(dcmtract) # declare include directories which hold for all subdirectories -INCLUDE_DIRECTORIES("${dcmtract_SOURCE_DIR}/include" "${dcmiod_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" ${ZLIB_INCDIR}) +include_directories("${dcmtract_SOURCE_DIR}/include" "${dcmiod_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" ${ZLIB_INCDIR}) # recurse into subdirectories -FOREACH(SUBDIR libsrc include) - ADD_SUBDIRECTORY(${SUBDIR}) -ENDFOREACH(SUBDIR) +foreach(SUBDIR libsrc include) + add_subdirectory(${SUBDIR}) +endforeach() diff --git a/dcmtract/include/CMakeLists.txt b/dcmtract/include/CMakeLists.txt index acf77adf8f..2a00579309 100644 --- a/dcmtract/include/CMakeLists.txt +++ b/dcmtract/include/CMakeLists.txt @@ -1,2 +1,2 @@ # declare installation files -INSTALL(DIRECTORY dcmtk/dcmtract DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") +install(DIRECTORY dcmtk/dcmtract DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") diff --git a/dcmwlm/CMakeLists.txt b/dcmwlm/CMakeLists.txt index 6ced5319ea..ae51efe3fc 100644 --- a/dcmwlm/CMakeLists.txt +++ b/dcmwlm/CMakeLists.txt @@ -1,10 +1,10 @@ # declare project -PROJECT(dcmwlm) +project(dcmwlm) # declare include directories which hold for all subdirectories -INCLUDE_DIRECTORIES("${dcmwlm_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" "${dcmnet_SOURCE_DIR}/include" ${ZLIB_INCDIR}) +include_directories("${dcmwlm_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" "${oflog_SOURCE_DIR}/include" "${dcmdata_SOURCE_DIR}/include" "${dcmnet_SOURCE_DIR}/include" ${ZLIB_INCDIR}) # recurse into subdirectories -FOREACH(SUBDIR libsrc apps include data tests) - ADD_SUBDIRECTORY(${SUBDIR}) -ENDFOREACH(SUBDIR) +foreach(SUBDIR libsrc apps include data tests) + add_subdirectory(${SUBDIR}) +endforeach() diff --git a/dcmwlm/apps/CMakeLists.txt b/dcmwlm/apps/CMakeLists.txt index ff553ba423..b91efd8900 100644 --- a/dcmwlm/apps/CMakeLists.txt +++ b/dcmwlm/apps/CMakeLists.txt @@ -1,5 +1,5 @@ # declare additional include directories -INCLUDE_DIRECTORIES("${dcmtls_SOURCE_DIR}/include") +include_directories("${dcmtls_SOURCE_DIR}/include") # declare executables DCMTK_ADD_EXECUTABLE(wlmscpfs wlmscpfs wlcefs) diff --git a/dcmwlm/data/CMakeLists.txt b/dcmwlm/data/CMakeLists.txt index 8e16ed8145..0bb377ca7c 100644 --- a/dcmwlm/data/CMakeLists.txt +++ b/dcmwlm/data/CMakeLists.txt @@ -1,2 +1,2 @@ # declare directories to be installed -INSTALL(DIRECTORY wlistdb wlistqry DESTINATION "${CMAKE_INSTALL_DATADIR}/dcmtk" COMPONENT data) +install(DIRECTORY wlistdb wlistqry DESTINATION "${CMAKE_INSTALL_DATADIR}/dcmtk" COMPONENT data) diff --git a/dcmwlm/include/CMakeLists.txt b/dcmwlm/include/CMakeLists.txt index e6ea5973c4..c346c59f21 100644 --- a/dcmwlm/include/CMakeLists.txt +++ b/dcmwlm/include/CMakeLists.txt @@ -1,2 +1,2 @@ # declare installation files -INSTALL(DIRECTORY dcmtk/dcmwlm DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") +install(DIRECTORY dcmtk/dcmwlm DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") diff --git a/doxygen/CMakeLists.txt b/doxygen/CMakeLists.txt index 0f53cf1cbe..dbee9474b1 100644 --- a/doxygen/CMakeLists.txt +++ b/doxygen/CMakeLists.txt @@ -1,73 +1,73 @@ # declare project -PROJECT(doxygen) +project(doxygen) # doxygen support -IF(DCMTK_WITH_DOXYGEN) +if(DCMTK_WITH_DOXYGEN) - IF(DOXYGEN_EXECUTABLE) - ADD_CUSTOM_TARGET(DOXYGEN) - ADD_CUSTOM_TARGET(html "${DOXYGEN_EXECUTABLE}" htmldocs.tmp) - ADD_DEPENDENCIES(DOXYGEN html) - IF(NOT WIN32) # For Unix systems, also build manpages - ADD_CUSTOM_TARGET(man COMMAND "${DOXYGEN_EXECUTABLE}" manpages.tmp + if(DOXYGEN_EXECUTABLE) + add_custom_target(DOXYGEN) + add_custom_target(html "${DOXYGEN_EXECUTABLE}" htmldocs.tmp) + add_dependencies(DOXYGEN html) + if(NOT WIN32) # For Unix systems, also build manpages + add_custom_target(man COMMAND "${DOXYGEN_EXECUTABLE}" manpages.tmp COMMAND rm -f "${CMAKE_CURRENT_BINARY_DIR}/manpages/man1/*.man.1" COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/patchman.sh") - ADD_DEPENDENCIES(DOXYGEN man) - ADD_CUSTOM_TARGET(man2text COMMAND "${CMAKE_COMMAND}" -E make_directory man2text + add_dependencies(DOXYGEN man) + add_custom_target(man2text COMMAND "${CMAKE_COMMAND}" -E make_directory man2text COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/man2text.sh") - ADD_DEPENDENCIES(man2text man) - ENDIF(NOT WIN32) - ENDIF(DOXYGEN_EXECUTABLE) + add_dependencies(man2text man) + endif() + endif() # generate a tag file in order to link to this documentation from external projects - IF(DCMTK_GENERATE_DOXYGEN_TAGFILE) - SET(DOXYGEN_TAGFILE "dcmtk.tag") - ENDIF(DCMTK_GENERATE_DOXYGEN_TAGFILE) + if(DCMTK_GENERATE_DOXYGEN_TAGFILE) + set(DOXYGEN_TAGFILE "dcmtk.tag") + endif() # create configuration files (expand variables) - SET(DCMTK_VERSION "${DCMTK_PACKAGE_VERSION}${PACKAGE_VERSION_SUFFIX}") - SET(DOXYGEN_INPUT_DIR "${CMAKE_SOURCE_DIR}") - SET(DOXYGEN_DATA_DIR "${CMAKE_CURRENT_SOURCE_DIR}") - CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/htmldocs.cfg" "${CMAKE_CURRENT_BINARY_DIR}/htmldocs.tmp" ESCAPE_QUOTES @ONLY) - IF(NOT WIN32) - CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/manpages.cfg" "${CMAKE_CURRENT_BINARY_DIR}/manpages.tmp" ESCAPE_QUOTES @ONLY) - ENDIF(NOT WIN32) + set(DCMTK_VERSION "${DCMTK_PACKAGE_VERSION}${PACKAGE_VERSION_SUFFIX}") + set(DOXYGEN_INPUT_DIR "${CMAKE_SOURCE_DIR}") + set(DOXYGEN_DATA_DIR "${CMAKE_CURRENT_SOURCE_DIR}") + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/htmldocs.cfg" "${CMAKE_CURRENT_BINARY_DIR}/htmldocs.tmp" ESCAPE_QUOTES @ONLY) + if(NOT WIN32) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/manpages.cfg" "${CMAKE_CURRENT_BINARY_DIR}/manpages.tmp" ESCAPE_QUOTES @ONLY) + endif() # Make sure these directories exist when we try to install them - INSTALL(CODE "FILE(MAKE_DIRECTORY \"${CMAKE_CURRENT_BINARY_DIR}/htmldocs\")" COMPONENT html) - IF(NOT WIN32) - INSTALL(CODE "FILE(MAKE_DIRECTORY \"${CMAKE_CURRENT_BINARY_DIR}/manpages\")" COMPONENT man) - ENDIF(NOT WIN32) + install(CODE "file(MAKE_DIRECTORY \"${CMAKE_CURRENT_BINARY_DIR}/htmldocs\")" COMPONENT html) + if(NOT WIN32) + install(CODE "file(MAKE_DIRECTORY \"${CMAKE_CURRENT_BINARY_DIR}/manpages\")" COMPONENT man) + endif() # install html docs and manpages - INSTALL(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/htmldocs/" DESTINATION "${CMAKE_INSTALL_DOCDIR}/html" COMPONENT html PATTERN "*.md5" EXCLUDE) - IF(DCMTK_GENERATE_DOXYGEN_TAGFILE) - INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${DOXYGEN_TAGFILE}" DESTINATION "${CMAKE_INSTALL_DOCDIR}" COMPONENT html OPTIONAL) - ENDIF(DCMTK_GENERATE_DOXYGEN_TAGFILE) - IF(NOT WIN32) - FILE(GLOB_RECURSE MANPAGES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/manpages/" "${CMAKE_CURRENT_SOURCE_DIR}/manpages/*.1") - FOREACH(MANPAGE ${MANPAGES}) - IF("${CMAKE_CURRENT_SOURCE_DIR}/manpages/${MANPAGE}" IS_NEWER_THAN "${CMAKE_CURRENT_BINARY_DIR}/manpages/${MANPAGE}") - GET_FILENAME_COMPONENT(DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/manpages/${MANPAGE}" PATH) - FILE(COPY "${CMAKE_CURRENT_SOURCE_DIR}/manpages/${MANPAGE}" DESTINATION "${DESTINATION}") - ENDIF() - ENDFOREACH() - INSTALL(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/manpages/" DESTINATION "${CMAKE_INSTALL_MANDIR}" COMPONENT man PATTERN "*_.1" EXCLUDE) - ENDIF(NOT WIN32) + install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/htmldocs/" DESTINATION "${CMAKE_INSTALL_DOCDIR}/html" COMPONENT html PATTERN "*.md5" EXCLUDE) + if(DCMTK_GENERATE_DOXYGEN_TAGFILE) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${DOXYGEN_TAGFILE}" DESTINATION "${CMAKE_INSTALL_DOCDIR}" COMPONENT html OPTIONAL) + endif() + if(NOT WIN32) + file(GLOB_RECURSE MANPAGES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/manpages/" "${CMAKE_CURRENT_SOURCE_DIR}/manpages/*.1") + foreach(MANPAGE ${MANPAGES}) + if("${CMAKE_CURRENT_SOURCE_DIR}/manpages/${MANPAGE}" IS_NEWER_THAN "${CMAKE_CURRENT_BINARY_DIR}/manpages/${MANPAGE}") + get_filename_component(DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/manpages/${MANPAGE}" PATH) + file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/manpages/${MANPAGE}" DESTINATION "${DESTINATION}") + endif() + endforeach() + install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/manpages/" DESTINATION "${CMAKE_INSTALL_MANDIR}" COMPONENT man PATTERN "*_.1" EXCLUDE) + endif() # the files in manpages/ and htmldocs/ should be removed by "make clean". - SET(make_clean_files "${CMAKE_CURRENT_BINARY_DIR}/htmldocs" "${CMAKE_CURRENT_BINARY_DIR}/manpages" "${CMAKE_CURRENT_BINARY_DIR}/man2text") - SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${make_clean_files}") + set(make_clean_files "${CMAKE_CURRENT_BINARY_DIR}/htmldocs" "${CMAKE_CURRENT_BINARY_DIR}/manpages" "${CMAKE_CURRENT_BINARY_DIR}/man2text") + set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${make_clean_files}") # the created files "htmldocs.tmp" and "manpages.tmp" should be removed with "make distclean", # which will (hopefully) be introduced in a future version, because they are only created during # the configure/generate process -ELSE(DCMTK_WITH_DOXYGEN) +else() # by default, install the pre-defined manpages, i.e. the ones shipped with this package - IF(NOT WIN32) - INSTALL(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/manpages/" DESTINATION "${CMAKE_INSTALL_MANDIR}" COMPONENT man) - ENDIF(NOT WIN32) + if(NOT WIN32) + install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/manpages/" DESTINATION "${CMAKE_INSTALL_MANDIR}" COMPONENT man) + endif() -ENDIF(DCMTK_WITH_DOXYGEN) +endif() diff --git a/oflog/CMakeLists.txt b/oflog/CMakeLists.txt index 7897e2aa5a..e454ac2d17 100644 --- a/oflog/CMakeLists.txt +++ b/oflog/CMakeLists.txt @@ -1,10 +1,10 @@ # declare project -PROJECT(oflog) +project(oflog) # declare include directories which hold for all subdirectories -INCLUDE_DIRECTORIES("${oflog_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include") +include_directories("${oflog_SOURCE_DIR}/include" "${ofstd_SOURCE_DIR}/include") # recurse into subdirectories -FOREACH(SUBDIR libsrc include etc) - ADD_SUBDIRECTORY(${SUBDIR}) -ENDFOREACH(SUBDIR) +foreach(SUBDIR libsrc include etc) + add_subdirectory(${SUBDIR}) +endforeach() diff --git a/oflog/etc/CMakeLists.txt b/oflog/etc/CMakeLists.txt index 583631922e..3a4063eb6f 100644 --- a/oflog/etc/CMakeLists.txt +++ b/oflog/etc/CMakeLists.txt @@ -1,2 +1,2 @@ # declare installation files -INSTALL(FILES logger.cfg filelog.cfg DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/dcmtk" COMPONENT etc) +install(FILES logger.cfg filelog.cfg DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/dcmtk" COMPONENT etc) diff --git a/oflog/include/CMakeLists.txt b/oflog/include/CMakeLists.txt index b28a84ad8c..5078d18088 100644 --- a/oflog/include/CMakeLists.txt +++ b/oflog/include/CMakeLists.txt @@ -1,2 +1,2 @@ # declare installation files -INSTALL(DIRECTORY dcmtk/oflog DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") +install(DIRECTORY dcmtk/oflog DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h") diff --git a/oflog/libsrc/CMakeLists.txt b/oflog/libsrc/CMakeLists.txt index 59a225178f..af13e5eafa 100644 --- a/oflog/libsrc/CMakeLists.txt +++ b/oflog/libsrc/CMakeLists.txt @@ -1,11 +1,11 @@ # create library from source files -IF(WIN32 AND NOT CYGWIN) +if(WIN32 AND NOT CYGWIN) # clfs needs extra libraries and thus is ignored here - SET(OFLOG_PLATFORM_LIBRARIES winsock windebap winconap) -ELSE(WIN32 AND NOT CYGWIN) - SET(OFLOG_PLATFORM_LIBRARIES unixsock) -ENDIF(WIN32 AND NOT CYGWIN) + set(OFLOG_PLATFORM_LIBRARIES winsock windebap winconap) +else() + set(OFLOG_PLATFORM_LIBRARIES unixsock) +endif() DCMTK_ADD_LIBRARY(oflog oflog apndimpl appender config consap factory fileap filter globinit hierarchy hierlock layout logger logimpl logevent loglevel loglog lloguser ndc ntelogap nullap objreg patlay pointer property rootlog sleep socketap sockbuff socket strhelp syncprims syslogap threads timehelp clogger env fileinfo lockfile mdc queue snprintf tls version log4judp logmacro asyncap cygwin32 striconv strcloc strccloc ${OFLOG_PLATFORM_LIBRARIES}) diff --git a/ofstd/CMakeLists.txt b/ofstd/CMakeLists.txt index d3ba0dd1bc..c69ea2b653 100644 --- a/ofstd/CMakeLists.txt +++ b/ofstd/CMakeLists.txt @@ -1,10 +1,10 @@ # declare project -PROJECT(ofstd) +project(ofstd) # declare include directories which hold for all subdirectories -INCLUDE_DIRECTORIES("${ofstd_SOURCE_DIR}/include" ${LIBICONV_INCDIR}) +include_directories("${ofstd_SOURCE_DIR}/include" ${LIBICONV_INCDIR}) # recurse into subdirectories -FOREACH(SUBDIR libsrc include tests) - ADD_SUBDIRECTORY(${SUBDIR}) -ENDFOREACH(SUBDIR) +foreach(SUBDIR libsrc include tests) + add_subdirectory(${SUBDIR}) +endforeach() diff --git a/ofstd/include/CMakeLists.txt b/ofstd/include/CMakeLists.txt index 5b04883461..edd0657597 100644 --- a/ofstd/include/CMakeLists.txt +++ b/ofstd/include/CMakeLists.txt @@ -1,2 +1,2 @@ # declare installation files -INSTALL(DIRECTORY dcmtk/ofstd DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h" PATTERN "*.def") +install(DIRECTORY dcmtk/ofstd DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dcmtk" COMPONENT include FILES_MATCHING PATTERN "*.h" PATTERN "*.def") diff --git a/ofstd/tests/CMakeLists.txt b/ofstd/tests/CMakeLists.txt index 2f401f5f1e..09de5a31c5 100644 --- a/ofstd/tests/CMakeLists.txt +++ b/ofstd/tests/CMakeLists.txt @@ -8,6 +8,6 @@ DCMTK_TARGET_LINK_MODULES(ofstd_tests ofstd) DCMTK_ADD_TESTS(ofstd) # Cleanup testfile.$$$ generated by the ofstd_OFFile exhaustive testcase. -SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES +set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_BINARY_DIR}/testfile.$$$" )