Skip to content

Instantly share code, notes, and snippets.

@geraldcombs
Created January 16, 2019 19:52
Show Gist options
  • Save geraldcombs/5cfb0f10758cadb582987faec9d4fd56 to your computer and use it in GitHub Desktop.
Save geraldcombs/5cfb0f10758cadb582987faec9d4fd56 to your computer and use it in GitHub Desktop.
CMakeLists.txt for libmaxminddb
# Adapted from https://github.com/Microsoft/vcpkg/blob/master/ports/libmaxminddb/CMakeLists.txt
cmake_minimum_required (VERSION 3.9)
project(maxminddb C)
set(CMAKE_DEBUG_POSTFIX d)
set(CMAKE_SHARED_LIBRARY_PREFIX lib)
set(CMAKE_STATIC_LIBRARY_PREFIX lib)
if(MSVC)
add_compile_options(-D_CRT_SECURE_NO_WARNINGS)
endif()
set(SRCS
src/maxminddb.c
src/data-pool.c
)
include_directories(. src include projects/VS12)
add_library(maxminddb ${SRCS})
if(WIN32)
target_link_libraries(maxminddb ws2_32)
include_directories(vcpkg-getopt/installed/x64-windows/include)
link_directories(vcpkg-getopt/installed/x64-windows/lib)
endif()
add_executable(mmdblookup bin/mmdblookup.c)
target_link_libraries(mmdblookup maxminddb)
install(
TARGETS maxminddb
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
if(NOT DISABLE_INSTALL_HEADERS)
install(FILES include/maxminddb.h projects/VS12/maxminddb_config.h DESTINATION include/maxminddb)
endif()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment