Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # CMakeLists.txt file for IP2LOCATION library - 2026-06-01
- #
- # 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(ip2location C)
- # Extra libraries.
- #
- SET(extra_libraries ws2_32.lib)
- # Miscellaneous options.
- #
- OPTION(INSTALL_PDB "Install .pdb file (if generated)" OFF)
- SET(ip2location_sources
- libip2location/ip2location.c
- )
- SET(ip2location_headers
- libip2location/ip2location.h
- )
- SET(ip2location_cli_sources
- ip2location.c
- )
- INCLUDE_DIRECTORIES(${CMAKE_INSTALL_PREFIX}/include ${CMAKE_SOURCE_DIR}/libip2location)
- ADD_LIBRARY(ip2location STATIC ${ip2location_sources})
- ADD_EXECUTABLE(ip2location_cli ${ip2location_cli_sources})
- TARGET_LINK_LIBRARIES(ip2location ${extra_libraries})
- TARGET_LINK_LIBRARIES(ip2location_cli ip2location ${extra_libraries})
- # Request compiler generated PDB file for ip2location library.
- #
- SET_TARGET_PROPERTIES(ip2location PROPERTIES
- COMPILE_PDB_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
- COMPILE_PDB_NAME ip2location
- )
- SET_TARGET_PROPERTIES(ip2location_cli PROPERTIES OUTPUT_NAME ip2location)
- INSTALL(TARGETS ip2location RUNTIME DESTINATION lib)
- INSTALL(FILES ${ip2location_headers} DESTINATION include)
- INSTALL(TARGETS ip2location_cli RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
- IF(INSTALL_PDB)
- # Install named PDB file for static build.
- #
- INSTALL(FILES ${CMAKE_BINARY_DIR}/ip2location.pdb
- DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
- CONFIGURATIONS RelWithDebInfo Debug OPTIONAL)
- ENDIF()
Add Comment
Please, Sign In to add comment