CMake: drop support for cmake < 3.5 1503/head
authorDominik Wójt <domin144@o2.pl>
Mon, 8 Jan 2024 17:07:04 +0000 (18:07 +0100)
committerDominik Wójt <domin144@o2.pl>
Mon, 8 Jan 2024 17:13:14 +0000 (18:13 +0100)
Compatibility for cmake version < 3.5 is now deprecated in cmake and
specifing version below 3.5 in cmake_minimum_required produces a
warning.[1]

[1] https://cmake.org/cmake/help/latest/release/3.27.html#deprecated-and-removed-features

CMakeLists.txt
src/bin/jp2/CMakeLists.txt
src/lib/openjp2/CMakeLists.txt
src/lib/openjpip/CMakeLists.txt
tests/nonregression/CMakeLists.txt
tools/ctest_scripts/travis-ci.cmake

index c6dd7080463857543166fc2b37cac4fcdfae3313..0ee16038aee7c5318d6b31154fbb9bfb8644e118 100644 (file)
@@ -7,14 +7,7 @@
 # For this purpose you can define a CMake var: OPENJPEG_NAMESPACE to whatever you like
 # e.g.:
 # set(OPENJPEG_NAMESPACE "GDCMOPENJPEG")
-cmake_minimum_required(VERSION 2.8.5)
-
-if(COMMAND CMAKE_POLICY)
-  cmake_policy(SET CMP0003 NEW)
-  if (NOT (${CMAKE_VERSION} VERSION_LESS 3.0))
-    cmake_policy(SET CMP0042 NEW)
-  endif()
-endif()
+cmake_minimum_required(VERSION 3.5)
 
 if(NOT OPENJPEG_NAMESPACE)
   set(OPENJPEG_NAMESPACE "OPENJPEG")
@@ -126,12 +119,6 @@ if(NOT OPENJPEG_INSTALL_PACKAGE_DIR)
 endif()
 
 if (APPLE)
-    if (${CMAKE_VERSION} VERSION_LESS 3.0)
-        # For cmake >= 3.0, we turn on CMP0042 and
-        # https://cmake.org/cmake/help/v3.0/policy/CMP0042.html mentions
-        # "Projects wanting @rpath in a target’s install name may remove any setting of the INSTALL_NAME_DIR and CMAKE_INSTALL_NAME_DIR variables"
-       list(APPEND OPENJPEG_LIBRARY_PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}")
-    endif()
        option(OPJ_USE_DSYMUTIL "Call dsymutil on binaries after build." OFF)
 endif()
 
@@ -304,21 +291,11 @@ endif()
 #-----------------------------------------------------------------------------
 # install all targets referenced as OPENJPEGTargets (relocatable with CMake 3.0+)
 install(EXPORT OpenJPEGTargets DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR})
-if (${CMAKE_VERSION} VERSION_LESS 3.0)
-  set(PACKAGE_INIT)
-  set(PACKAGE_CMAKE_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_FULL_INCLUDEDIR})
-  configure_file( ${${OPENJPEG_NAMESPACE}_SOURCE_DIR}/cmake/OpenJPEGConfig.cmake.in
-    ${${OPENJPEG_NAMESPACE}_BINARY_DIR}/OpenJPEGConfig.cmake
-    @ONLY
-  )
-else()
-  include(CMakePackageConfigHelpers)
-  configure_package_config_file(${CMAKE_CURRENT_LIST_DIR}/cmake/OpenJPEGConfig.cmake.in
-    ${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake
-    INSTALL_DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR}
-    PATH_VARS CMAKE_INSTALL_INCLUDEDIR)
-endif()
-
+include(CMakePackageConfigHelpers)
+configure_package_config_file(${CMAKE_CURRENT_LIST_DIR}/cmake/OpenJPEGConfig.cmake.in
+  ${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake
+  INSTALL_DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR}
+  PATH_VARS CMAKE_INSTALL_INCLUDEDIR)
 install( FILES ${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake
   DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR}
 )
index 29b4dd2088db7c86a32508a7c51d45be53e8a415..26156bcbfe3fe227c4be3e6c1567bef38e53767e 100644 (file)
@@ -44,9 +44,7 @@ endif()
 # Loop over all executables:
 foreach(exe opj_decompress opj_compress opj_dump)
   add_executable(${exe} ${exe}.c ${common_SRCS})
-  if(NOT ${CMAKE_VERSION} VERSION_LESS "2.8.12")
-    target_compile_options(${exe} PRIVATE ${OPENJP2_COMPILE_OPTIONS})
-  endif()
+  target_compile_options(${exe} PRIVATE ${OPENJP2_COMPILE_OPTIONS})
   target_link_libraries(${exe} ${OPENJPEG_LIBRARY_NAME}
     ${PNG_LIBNAME} ${TIFF_LIBNAME} ${LCMS_LIBNAME}
     )
index 8fda14dc4f332c140c77a2faf76aa30c13dcc380..99cf580a4d1e328e53255f1a4d27ed651911163a 100644 (file)
@@ -109,9 +109,7 @@ if(UNIX)
   target_link_libraries(${OPENJPEG_LIBRARY_NAME} m)
 endif()
 set_target_properties(${OPENJPEG_LIBRARY_NAME} PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES})
-if(NOT ${CMAKE_VERSION} VERSION_LESS "2.8.12")
-  target_compile_options(${OPENJPEG_LIBRARY_NAME} PRIVATE ${OPENJP2_COMPILE_OPTIONS})
-endif()
+target_compile_options(${OPENJPEG_LIBRARY_NAME} PRIVATE ${OPENJP2_COMPILE_OPTIONS})
 
 # Install library
 install(TARGETS ${INSTALL_LIBS}
index aace36d4d732f698b72897759866cee07cf3c40b..e9d81930674e3c3dcd09a2aaebb180bcba6bf60c 100644 (file)
@@ -62,9 +62,7 @@ endif()
 add_library(openjpip ${OPENJPIP_SRCS} ${LOCAL_SRCS})
 set_target_properties(openjpip
   PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES})
-if(NOT ${CMAKE_VERSION} VERSION_LESS "2.8.12")
-  target_compile_options(openjpip PRIVATE ${OPENJPEG_LIBRARY_COMPILE_OPTIONS})
-endif()
+target_compile_options(openjpip PRIVATE ${OPENJPEG_LIBRARY_COMPILE_OPTIONS})
 target_link_libraries(openjpip ${OPENJPEG_LIBRARY_NAME})
 if(WIN32)
   # add Winsock on windows+mingw
index 05fce40ce271430ac476561b48be81afe7af8e3c..5199057781d7304468c84b5557ada7f04a53e6ea 100644 (file)
@@ -1,6 +1,6 @@
 # NON-REGRESSION TESTS ON THIS DATASET LOCATED ${OPJ_DATA_ROOT}/input/nonregression
 
-cmake_minimum_required(VERSION 2.8.7)
+cmake_minimum_required(VERSION 3.5)
 
 file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Temporary)
 
index b9f75fff3ac5905b71807c29053a592a25f74a3e..7d1c9f32502339b41248a0243dac7f15af2bad6c 100644 (file)
@@ -4,7 +4,7 @@
 # Results will be available at: http://my.cdash.org/index.php?project=OPENJPEG
 # -----------------------------------------------------------------------------
 
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 3.5)
 
 set( ENV{LANG} en_US.UTF-8)
 if($ENV{OPJ_BINARY_DIR})