mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-27 19:39:00 +08:00
852d471ff3
* shlwapi is not available on linux This fixes error while building for `x64-linux-dynamic`. * Update control version * Update port_versions Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com> Co-authored-by: NancyLi1013 <lirui09@beyondsoft.com>
56 lines
1.2 KiB
CMake
56 lines
1.2 KiB
CMake
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
|
|
lib/grammar.c
|
|
lib/libconfig.c
|
|
lib/scanctx.c
|
|
lib/scanner.c
|
|
lib/strbuf.c
|
|
lib/strvec.c
|
|
lib/util.c
|
|
lib/wincompat.c
|
|
)
|
|
|
|
set(CPP_SOURCES
|
|
lib/libconfigcpp.cc
|
|
)
|
|
|
|
find_path(STDINT_H stdint.h)
|
|
|
|
include_directories(lib ${STDINT_H})
|
|
|
|
add_definitions(-DYY_NO_UNISTD_H -DYY_USE_CONST)
|
|
|
|
add_library(libconfig ${C_SOURCES})
|
|
add_library(libconfig++ ${CPP_SOURCES})
|
|
|
|
if(BUILD_SHARED_LIBS)
|
|
target_compile_definitions(libconfig PRIVATE -DLIBCONFIG_EXPORTS)
|
|
target_compile_definitions(libconfig++ PRIVATE -DLIBCONFIGXX_EXPORTS)
|
|
else()
|
|
target_compile_definitions(libconfig PUBLIC -DLIBCONFIG_STATIC)
|
|
target_compile_definitions(libconfig++ PUBLIC -DLIBCONFIGXX_STATIC)
|
|
endif()
|
|
|
|
if (WIN32)
|
|
# Linux doesn't have shlwapi
|
|
target_link_libraries(libconfig shlwapi)
|
|
endif()
|
|
target_link_libraries(libconfig++ PRIVATE libconfig)
|
|
|
|
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)
|
|
endif()
|