vcpkg/ports/libconfig/CMakeLists.txt

52 lines
1.2 KiB
CMake
Raw Normal View History

2017-06-29 04:21:01 +08:00
cmake_minimum_required(VERSION 3.5.1)
project(libconfig C CXX)
if(MSVC)
add_compile_options(/W3 /wd4005 /wd4996 /wd4018 -D_CRT_SECURE_NO_WARNINGS)
add_definitions(-Dscandir=libconfig_scandir)
2017-06-29 04:21:01 +08:00
endif()
set(C_SOURCES
2017-06-30 04:38:45 +08:00
lib/grammar.c
lib/libconfig.c
lib/scanctx.c
lib/win32/scandir.c
lib/scanner.c
lib/strbuf.c
2017-06-29 04:21:01 +08:00
)
set(CPP_SOURCES
2017-06-30 04:38:45 +08:00
lib/libconfigcpp.cc
2017-06-29 04:21:01 +08:00
)
2017-06-30 06:18:58 +08:00
find_path(DIRENT_H dirent.h)
find_path(STDINT_H stdint.h)
include_directories(lib ${DIRENT_H} ${STDINT_H})
add_definitions(-DYY_NO_UNISTD_H -DYY_USE_CONST)
2017-06-29 04:21:01 +08:00
2017-06-30 04:38:45 +08:00
add_library(libconfig ${C_SOURCES})
add_library(libconfig++ ${CPP_SOURCES})
2017-06-30 04:38:45 +08:00
if(BUILD_SHARED_LIBS)
target_compile_definitions(libconfig PRIVATE -DLIBCONFIG_EXPORTS)
target_compile_definitions(libconfig++ PRIVATE -DLIBCONFIGXX_EXPORTS)
2017-06-29 04:21:01 +08:00
else()
target_compile_definitions(libconfig PUBLIC -DLIBCONFIG_STATIC)
target_compile_definitions(libconfig++ PUBLIC -DLIBCONFIGXX_STATIC)
2017-06-29 04:21:01 +08:00
endif()
target_link_libraries(libconfig++ PRIVATE libconfig)
2017-06-29 04:21:01 +08:00
install(
TARGETS libconfig libconfig++
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
if(NOT DISABLE_INSTALL_HEADERS)
install(FILES lib/libconfig.h++ lib/libconfig.h DESTINATION include)
2017-06-29 04:21:01 +08:00
endif()