tangentia

CMakeLists - ip2location-apache-8.6.0.txt

May 26th, 2026 (edited)
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CMake 2.56 KB | None | 0 0
  1. # CMakeLists.txt file for MOD_IP2LOCATION - 2026-05-26
  2. #
  3. # Licensed to the Apache Software Foundation (ASF) under one or more
  4. # contributor license agreements.  See the NOTICE file distributed with
  5. # this work for additional information regarding copyright ownership.
  6. # The ASF licenses this file to You under the Apache License, Version 2.0
  7. # (the "License"); you may not use this file except in compliance with
  8. # the License.  You may obtain a copy of the License at
  9. #
  10. #     http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. #
  18. CMAKE_MINIMUM_REQUIRED(VERSION 3.15)
  19.  
  20. PROJECT(mod_ip2location C)
  21.  
  22. IF(NOT EXISTS ${CMAKE_INSTALL_PREFIX}/lib/libhttpd.lib)
  23.   MESSAGE(FATAL_ERROR "libhttpd.lib was not found in prefix ${CMAKE_INSTALL_PREFIX}")
  24. ENDIF()
  25.  
  26. # Select APR trunk (libapr-2.lib) if it exists in PREFIX/lib; otherwise, select
  27. # APR 1.x + APR-util 1.x
  28. #
  29. IF(EXISTS "${CMAKE_INSTALL_PREFIX}/lib/libapr-2.lib")
  30.   SET(apr_libraries
  31.     ${CMAKE_INSTALL_PREFIX}/lib/libapr-2.lib)
  32. ELSEIF(EXISTS "${CMAKE_INSTALL_PREFIX}/lib/libapr-1.lib")
  33.   SET(apr_libraries
  34.     ${CMAKE_INSTALL_PREFIX}/lib/libapr-1.lib
  35.     ${CMAKE_INSTALL_PREFIX}/lib/libaprutil-1.lib)
  36. ELSE()
  37.   MESSAGE(FATAL_ERROR "APR libraries were not found in prefix ${CMAKE_INSTALL_PREFIX}")
  38. ENDIF()
  39.  
  40. IF(EXISTS ${CMAKE_INSTALL_PREFIX}/lib/ip2location.lib)
  41.   SET(ip2location_libraries
  42.       ${CMAKE_INSTALL_PREFIX}/lib/ip2location.lib)
  43. ELSE()
  44.   MESSAGE(FATAL_ERROR "ip2location.lib was not found in prefix ${CMAKE_INSTALL_PREFIX}")
  45. ENDIF()
  46.  
  47. # Extra libraries.
  48. #
  49. SET(extra_libraries ws2_32.lib)
  50.  
  51. # Miscellaneous options.
  52. #
  53. OPTION(INSTALL_PDB "Install .pdb file (if generated)" OFF)
  54.  
  55. SET(mod_ip2location_sources
  56.   mod_ip2location.c
  57. )
  58.  
  59. INCLUDE_DIRECTORIES(${CMAKE_INSTALL_PREFIX}/include)
  60. ADD_LIBRARY(mod_ip2location SHARED ${mod_ip2location_sources})
  61.  
  62. SET_TARGET_PROPERTIES(mod_ip2location PROPERTIES SUFFIX .so)
  63. TARGET_LINK_LIBRARIES(mod_ip2location ${CMAKE_INSTALL_PREFIX}/lib/libhttpd.lib
  64.   ${apr_libraries} ${ip2location_libraries} ${extra_libraries})
  65.  
  66. INSTALL(TARGETS mod_ip2location RUNTIME DESTINATION modules)
  67.  
  68. IF(INSTALL_PDB)
  69.   INSTALL(FILES $<TARGET_PDB_FILE:mod_ip2location>
  70.     DESTINATION ${CMAKE_INSTALL_PREFIX}/modules
  71.     CONFIGURATIONS RelWithDebInfo Debug OPTIONAL)
  72. ENDIF()
  73.  
Tags: cmake
Add Comment
Please, Sign In to add comment