Skip to content

Instantly share code, notes, and snippets.

@redstar
Created May 15, 2014 05:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save redstar/d5694a6301c40ceb0720 to your computer and use it in GitHub Desktop.
Save redstar/d5694a6301c40ceb0720 to your computer and use it in GitHub Desktop.
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