From 61ea3eb1a18c3570efa8a11597251099d7b630bb Mon Sep 17 00:00:00 2001 From: Aous Naman Date: Sun, 25 Feb 2024 18:46:08 +1100 Subject: [PATCH] This removes the hardcoded TIFF_PATH, must use CMAKE_PREFIX_PATH instead. --- CMakeLists.txt | 6 +----- src/apps/CMakeLists.txt | 21 ++++----------------- tests/CMakeLists.txt | 11 ++++------- 3 files changed, 9 insertions(+), 29 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ed25302..c9c6db9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,11 +19,6 @@ option(OJPH_ENABLE_TIFF_SUPPORT "Enables input and output support for TIFF files option(OJPH_BUILD_TESTS "Enables building test code" OFF) option(OJPH_BUILD_EXECUTABLES "Enables building command line executables" ON) -## specify the top directory for TIFF library (only for Microsoft Visual Studio) -if (MSVC) - set(TIFF_PATH "C:\\Program Files\\tiff") -endif() - ## Setting some of the options if EMSCRIPTEN is the compiler if(EMSCRIPTEN) set(OJPH_DISABLE_INTEL_SIMD ON) @@ -52,6 +47,7 @@ endif() message(STATUS "Building ${CMAKE_BUILD_TYPE}") ## C++ version and flags +# C++14 is needed for gtest, otherwise, C++11 is sufficient for the library set(CMAKE_CXX_STANDARD 14) if (MSVC) add_compile_options(-D_CRT_SECURE_NO_WARNINGS) diff --git a/src/apps/CMakeLists.txt b/src/apps/CMakeLists.txt index acc1670..b3ef06d 100644 --- a/src/apps/CMakeLists.txt +++ b/src/apps/CMakeLists.txt @@ -3,29 +3,16 @@ ############################################################ if( OJPH_ENABLE_TIFF_SUPPORT ) - if( MSVC ) - - set(TIFF_INCLUDE_DIR "${TIFF_PATH}\\include" CACHE PATH "the directory containing the TIFF headers") - set(TIFF_LIBRARY_DEBUG "${TIFF_PATH}\\lib\\tiffd.lib" CACHE FILEPATH "the path to the TIFF library for debug configurations") - set(TIFF_LIBRARY_RELEASE "${TIFF_PATH}\\lib\\tiff.lib" CACHE FILEPATH "the path to the TIFF library for release configurations") - set(TIFFXX_LIBRARY_DEBUG "${TIFF_PATH}\\lib\\tiffxxd.lib" CACHE FILEPATH "the path to the TIFFXX library for debug configurations") - set(TIFFXX_LIBRARY_RELEASE "${TIFF_PATH}\\lib\\tiffxx.lib" CACHE FILEPATH "the path to the TIFFXX library for release configurations") - - message( STATUS "WIN32 detected: Setting CMakeCache TIFF values as follows, use CMake-gui Advanced to modify them" ) - message( STATUS " TIFF_INCLUDE_DIR : \"${TIFF_INCLUDE_DIR}\" " ) - message( STATUS " TIFF_LIBRARY_DEBUG : \"${TIFF_LIBRARY_DEBUG}\" " ) - message( STATUS " TIFF_LIBRARY_RELEASE : \"${TIFF_LIBRARY_RELEASE}\" " ) - message( STATUS " TIFFXX_LIBRARY_DEBUG : \"${TIFFXX_LIBRARY_DEBUG}\" " ) - message( STATUS " TIFFXX_LIBRARY_RELEASE : \"${TIFFXX_LIBRARY_RELEASE}\" " ) - - endif( MSVC ) - FIND_PACKAGE( TIFF ) if( TIFF_FOUND ) set(USE_TIFF TRUE CACHE BOOL "Add TIFF support") include_directories( ${TIFF_INCLUDE_DIR} ) add_definitions(-DOJPH_ENABLE_TIFF_SUPPORT) + elseif(MSVC) + message(STATUS "TIFF support has been enabled by no path to the TIFF library " + "has been specified; please configure with -DCMAKE_PREFIX_PATH=, " + "or disable TIFF support using -DOJPH_ENABLE_TIFF_SUPPORT=OFF.") endif( TIFF_FOUND ) endif() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 03ac41c..48c8f67 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -59,13 +59,10 @@ if (MSVC) COMMAND ${CMAKE_COMMAND} -E copy "./\$(Configuration)/mse_pae.exe" "./" ) if (MSVC AND OJPH_ENABLE_TIFF_SUPPORT) - if (CMAKE_BUILD_TYPE MATCHES "Release") - file(COPY "${TIFF_PATH}\\bin\\tiff.dll" DESTINATION "./") - file(COPY "${TIFF_PATH}\\bin\\tiffxx.dll" DESTINATION "./") - elseif(CMAKE_BUILD_TYPE MATCHES "Debug") - file(COPY "${TIFF_PATH}\\bin\\tiffd.dll" DESTINATION "./") - file(COPY "${TIFF_PATH}\\bin\\tiffxxd.dll" DESTINATION "./") - endif() + file(COPY "${TIFF_INCLUDE_DIR}\\..\\bin\\tiff.dll" DESTINATION "./") + file(COPY "${TIFF_INCLUDE_DIR}\\..\\bin\\tiffxx.dll" DESTINATION "./") + file(COPY "${TIFF_INCLUDE_DIR}\\..\\bin\\tiffd.dll" DESTINATION "./") + file(COPY "${TIFF_INCLUDE_DIR}\\..\\bin\\tiffxxd.dll" DESTINATION "./") endif() else() add_custom_command(TARGET test_executables POST_BUILD