Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # CMakeLists.txt file for MOD_IP2LOCATION - 2026-05-26
- #
- # Licensed to the Apache Software Foundation (ASF) under one or more
- # contributor license agreements. See the NOTICE file distributed with
- # this work for additional information regarding copyright ownership.
- # The ASF licenses this file to You under the Apache License, Version 2.0
- # (the "License"); you may not use this file except in compliance with
- # the License. You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing, software
- # distributed under the License is distributed on an "AS IS" BASIS,
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- # See the License for the specific language governing permissions and
- # limitations under the License.
- #
- CMAKE_MINIMUM_REQUIRED(VERSION 3.15)
- PROJECT(mod_ip2location C)
- IF(NOT EXISTS ${CMAKE_INSTALL_PREFIX}/lib/libhttpd.lib)
- MESSAGE(FATAL_ERROR "libhttpd.lib was not found in prefix ${CMAKE_INSTALL_PREFIX}")
- ENDIF()
- # Select APR trunk (libapr-2.lib) if it exists in PREFIX/lib; otherwise, select
- # APR 1.x + APR-util 1.x
- #
- IF(EXISTS "${CMAKE_INSTALL_PREFIX}/lib/libapr-2.lib")
- SET(apr_libraries
- ${CMAKE_INSTALL_PREFIX}/lib/libapr-2.lib)
- ELSEIF(EXISTS "${CMAKE_INSTALL_PREFIX}/lib/libapr-1.lib")
- SET(apr_libraries
- ${CMAKE_INSTALL_PREFIX}/lib/libapr-1.lib
- ${CMAKE_INSTALL_PREFIX}/lib/libaprutil-1.lib)
- ELSE()
- MESSAGE(FATAL_ERROR "APR libraries were not found in prefix ${CMAKE_INSTALL_PREFIX}")
- ENDIF()
- IF(EXISTS ${CMAKE_INSTALL_PREFIX}/lib/ip2location.lib)
- SET(ip2location_libraries
- ${CMAKE_INSTALL_PREFIX}/lib/ip2location.lib)
- ELSE()
- MESSAGE(FATAL_ERROR "ip2location.lib was not found in prefix ${CMAKE_INSTALL_PREFIX}")
- ENDIF()
- # Extra libraries.
- #
- SET(extra_libraries ws2_32.lib)
- # Miscellaneous options.
- #
- OPTION(INSTALL_PDB "Install .pdb file (if generated)" OFF)
- SET(mod_ip2location_sources
- mod_ip2location.c
- )
- INCLUDE_DIRECTORIES(${CMAKE_INSTALL_PREFIX}/include)
- ADD_LIBRARY(mod_ip2location SHARED ${mod_ip2location_sources})
- SET_TARGET_PROPERTIES(mod_ip2location PROPERTIES SUFFIX .so)
- TARGET_LINK_LIBRARIES(mod_ip2location ${CMAKE_INSTALL_PREFIX}/lib/libhttpd.lib
- ${apr_libraries} ${ip2location_libraries} ${extra_libraries})
- INSTALL(TARGETS mod_ip2location RUNTIME DESTINATION modules)
- IF(INSTALL_PDB)
- INSTALL(FILES $<TARGET_PDB_FILE:mod_ip2location>
- DESTINATION ${CMAKE_INSTALL_PREFIX}/modules
- CONFIGURATIONS RelWithDebInfo Debug OPTIONAL)
- ENDIF()
Add Comment
Please, Sign In to add comment