vcpkg/ports/libconfig/CMakeLists.txt

51 lines
1.2 KiB
CMake
Raw Normal View History

2017-06-28 13:21:01 -07: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)
endif()
set(C_SOURCES
2017-06-29 13:38:45 -07:00
lib/grammar.c
lib/libconfig.c
lib/scanctx.c
lib/win32/scandir.c
lib/scanner.c
lib/strbuf.c
2017-06-28 13:21:01 -07:00
)
set(CPP_SOURCES
2017-06-29 13:38:45 -07:00
lib/libconfigcpp.cc
2017-06-28 13:21:01 -07:00
)
2017-06-29 13:38:45 -07:00
include_directories(lib)
2017-06-29 15:18:58 -07:00
find_path(DIRENT_H dirent.h)
find_path(STDINT_H stdint.h)
include_directories(${DIRENT_H})
include_directories(${STDINT_H})
2017-06-28 13:21:01 -07:00
2017-06-29 13:38:45 -07:00
add_library(libconfig ${C_SOURCES})
add_library(libconfig++ ${C_SOURCES} ${CPP_SOURCES})
2017-06-28 13:21:01 -07:00
2017-06-29 13:38:45 -07:00
if(BUILD_SHARED_LIBS)
2017-06-28 13:21:01 -07:00
target_compile_definitions(libconfig PRIVATE -DLIBCONFIG_EXPORTS -DYY_NO_UNISTD_H -DYY_USE_CONST)
target_compile_definitions(libconfig++ PRIVATE -DLIBCONFIG_EXPORTS -DLIBCONFIGXX_EXPORTS -DYY_NO_UNISTD_H -DYY_USE_CONST)
else()
target_compile_definitions(libconfig PRIVATE -DLIBCONFIG_STATIC -DYY_NO_UNISTD_H)
target_compile_definitions(libconfig++ PRIVATE -DLIBCONFIG_STATIC -DYY_NO_UNISTD_H)
endif()
install(
TARGETS libconfig libconfig++
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
if(NOT DISABLE_INSTALL_HEADERS)
2017-06-29 13:38:45 -07:00
install(FILES lib/libconfig.h++ lib/libconfig.h DESTINATION include)
2017-06-28 13:21:01 -07:00
endif()