Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
CMakeLists.txt file for libconfig++
# CMake build file for libconfig++
cmake_minimum_required(VERSION 2.8)
project(libconfig++)
set(LIBCONFIG++_SOURCE_DIR ${PROJECT_SOURCE_DIR}/lib)
set(LIBCONFIG++__BINARY_DIR ${PROJECT_BINARY_DIR})
set(LIBCONFIG++_SOURCES
${LIBCONFIG++_SOURCE_DIR}/grammar.c
${LIBCONFIG++_SOURCE_DIR}/libconfig.c
${LIBCONFIG++_SOURCE_DIR}/libconfigcpp.c++
${LIBCONFIG++_SOURCE_DIR}/scanctx.c
${LIBCONFIG++_SOURCE_DIR}/scanner.c
${LIBCONFIG++_SOURCE_DIR}/strbuf.c
)
include_directories(${LIBCONFIG++_SOURCE_DIR})
add_definitions(
/DLIBCONFIGXX_EXPORTS
/DLIBCONFIG_STATIC
)
if (MSVC)
add_definitions(
/DYY_NO_UNISTD_H
/DYY_USE_CONST
/Gd /EHsc
)
endif (MSVC)
foreach(file ${LIBCONFIG++_SOURCES})
if(file MATCHES ".*\\.c$")
set_source_files_properties(${file} PROPERTIES
LANGUAGE C
)
else()
set_source_files_properties(${file} PROPERTIES
LANGUAGE CXX
)
endif()
endforeach()
add_library(libconfig++ STATIC ${LIBCONFIG++_SOURCES})
set_target_properties(
libconfig++ PROPERTIES
ARCHIVE_OUTPUT_NAME libconfig++
LIBRARY_OUTPUT_NAME libconfig++
RUNTIME_OUTPUT_NAME libconfig++
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment