Skip to content

Commit

Permalink
Merge pull request #6517 from jmckenna/cmake-policy-warnings
Browse files Browse the repository at this point in the history
handle various CMake policy warnings
  • Loading branch information
jmckenna committed May 11, 2022
2 parents 977b4a1 + a26877a commit 91c550c
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 16 deletions.
19 changes: 6 additions & 13 deletions CMakeLists.txt
@@ -1,14 +1,7 @@
cmake_minimum_required (VERSION 3.0)
cmake_minimum_required(VERSION 3.0...3.23)

project (MapServer)

if (${CMAKE_VERSION} GREATER "3.13")
cmake_policy(SET CMP0078 OLD) # related to UseSWIG
endif()
if (${CMAKE_VERSION} GREATER "3.14")
cmake_policy(SET CMP0086 OLD) # related to UseSWIG
endif()

if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
message(FATAL_ERROR "In-source builds are not permitted. Make a separate folder for building:
mkdir build; cd build; cmake ..
Expand Down Expand Up @@ -443,7 +436,7 @@ if(USE_PBF)
endif()

if(WITH_PIXMAN)
find_package(Pixman)
find_package(PIXMAN)
if(PIXMAN_FOUND)
include_directories(${PIXMAN_INCLUDE_DIR})
ms_link_libraries(${PIXMAN_LIBRARY})
Expand Down Expand Up @@ -542,7 +535,7 @@ if(WITH_ORACLESPATIAL OR WITH_ORACLE_PLUGIN)
if(NOT DEFINED ENV{ORACLE_HOME})
MESSAGE( SEND_ERROR "ORACLE_HOME environment variable not set, needed for detection")
endif()
find_package(Oracle)
find_package(ORACLE)
if(ORACLE_FOUND)
include_directories(${ORACLE_INCLUDE_DIR})
list(APPEND ALL_INCLUDE_DIRS ${ORACLE_INCLUDE_DIR})
Expand Down Expand Up @@ -802,14 +795,14 @@ endif(WITH_GIF)

if(WITH_EXEMPI)
find_package(Exempi)
if(LIBEXEMPI_FOUND)
if(EXEMPI_FOUND)
include_directories(${LIBEXEMPI_INCLUDE_DIR})
ms_link_libraries( ${LIBEXEMPI_LIBRARY})
list(APPEND ALL_INCLUDE_DIRS ${LIBEXEMPI_INCLUDE_DIR})
set(USE_EXEMPI 1)
else(LIBEXEMPI_FOUND)
else(EXEMPI_FOUND)
report_optional_not_found(EXEMPI)
endif(LIBEXEMPI_FOUND)
endif(EXEMPI_FOUND)
endif(WITH_EXEMPI)

if(WITH_PYTHON)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindExempi.cmake
Expand Up @@ -7,5 +7,5 @@ find_library(LIBEXEMPI_LIBRARY NAMES exempi)
set(LIBEXEMPI_LIBRARIES ${LIBEXEMPI_LIBRARY})
set(LIBEXEMPI_INCLUDE_DIRS ${LIBEXEMPI_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LIBEXEMPI DEFAULT_MSG LIBEXEMPI_LIBRARY LIBEXEMPI_INCLUDE_DIR)
find_package_handle_standard_args(Exempi DEFAULT_MSG LIBEXEMPI_LIBRARY LIBEXEMPI_INCLUDE_DIR)
mark_as_advanced(LIBEXEMPI_INCLUDE_DIR LIBEXEMPI_LIBRARY)
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions cmake/FindSVGCairo.cmake
Expand Up @@ -44,7 +44,9 @@ include(FindPackageHandleStandardArgs)

set(SVG_INCLUDE_DIRS ${SVG_INCLUDE_DIR})
set(SVG_LIBRARIES ${SVG_LIBRARY})
set(FPHSA_NAME_MISMATCHED TRUE) #handle mismatched package name warning
find_package_handle_standard_args(SVG DEFAULT_MSG SVG_LIBRARY SVG_INCLUDE_DIR)
unset(FPHSA_NAME_MISMATCHED)
mark_as_advanced(SVG_LIBRARY SVG_INCLUDE_DIR)
set(SVGCAIRO_INCLUDE_DIRS ${SVGCAIRO_INCLUDE_DIR})
set(SVGCAIRO_LIBRARIES ${SVGCAIRO_LIBRARY})
Expand Down
10 changes: 8 additions & 2 deletions mapscript/python/CMakeLists.txt
Expand Up @@ -60,7 +60,7 @@ add_custom_target(
)

add_custom_command(
DEPENDS ${SWIG_MODULE_pythonmapscript_REAL_NAME}
DEPENDS ${SWIG_MODULE_pythonmapscript_REAL_NAME} pythonmapscript_copyfiles
OUTPUT mapscriptvenv.stamp
WORKING_DIRECTORY ${OUTPUT_FOLDER}
COMMAND ${Python_EXECUTABLE} -m pip install pip --upgrade
Expand Down Expand Up @@ -103,7 +103,7 @@ add_custom_command(
)

add_custom_command(
TARGET _pythonmapscript
OUTPUT mapscriptcopyfiles.stamp
WORKING_DIRECTORY ${OUTPUT_FOLDER}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/mapscript/python/mapscript/__init__.py" $<TARGET_FILE_DIR:${SWIG_MODULE_pythonmapscript_REAL_NAME}>/mapscript/__init__.py
Expand All @@ -116,6 +116,12 @@ add_custom_command(
COMMENT "Copying files required to build Mapscript"
)

# handle CMake CMP0040 policy error
add_custom_target(
pythonmapscript_copyfiles
DEPENDS mapscriptcopyfiles.stamp
)

install(
CODE "
Expand Down

0 comments on commit 91c550c

Please sign in to comment.