CMake: Add support for CppParser

This commit is contained in:
Pascal Bach 2014-12-11 10:17:08 +01:00 committed by Pascal Bach
parent af1b94602a
commit d9c0d2b495
4 changed files with 80 additions and 0 deletions

View File

@ -84,6 +84,7 @@ option(ENABLE_DATA_ODBC "Enable Data ODBC" ON)
option(ENABLE_SEVENZIP "Enable SevenZip" ON)
option(ENABLE_ZIP "Enable Zip" ON)
option(ENABLE_APACHECONNECTOR "Enable ApacheConnector" ON)
option(ENABLE_CPPPARSER "Enable C++ parser" ON)
option(FORCE_OPENSSL "Force usage of OpenSSL even under windows" OFF)
@ -249,6 +250,11 @@ if(APRUTIL_FOUND AND APACHE_FOUND)
endif()
endif(APRUTIL_FOUND AND APACHE_FOUND)
if(ENABLE_CPPPARSER)
add_subdirectory(CppParser)
list(APPEND Poco_COMPONENTS "CppParser")
endif()
#############################################################
# Uninstall stuff see: http://www.vtk.org/Wiki/CMake_FAQ
configure_file(

49
CppParser/CMakeLists.txt Normal file
View File

@ -0,0 +1,49 @@
set(LIBNAME "CppParser")
set(POCO_LIBNAME "Poco${LIBNAME}")
# Sources
file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( SRCS ${SRCS_G})
# Headers
file(GLOB_RECURSE HDRS_G "include/*.h" )
POCO_HEADERS_AUTO( SRCS ${HDRS_G})
add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} )
add_library( "${POCO_LIBNAME}" ALIAS "${LIBNAME}")
set_target_properties( "${LIBNAME}"
PROPERTIES
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION}
OUTPUT_NAME ${POCO_LIBNAME}
DEFINE_SYMBOL CppParser_EXPORTS
)
target_link_libraries( "${LIBNAME}" Foundation)
target_include_directories( "${LIBNAME}"
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
)
install(
DIRECTORY include/Poco
DESTINATION include
COMPONENT Devel
PATTERN ".svn" EXCLUDE
)
install(
TARGETS "${LIBNAME}" EXPORT "${LIBNAME}Targets"
LIBRARY DESTINATION lib${LIB_SUFFIX}
ARCHIVE DESTINATION lib${LIB_SUFFIX}
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)
POCO_GENERATE_PACKAGE("${LIBNAME}" "${LIBNAME}Targets" "lib/cmake/${PROJECT_NAME}")
if (ENABLE_TESTS)
add_subdirectory(testsuite)
endif ()

View File

@ -0,0 +1,4 @@
include(CMakeFindDependencyMacro)
set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_LIST_DIR})
find_dependency(PocoFoundation)
include("${CMAKE_CURRENT_LIST_DIR}/PocoCppParserTargets.cmake")

View File

@ -0,0 +1,21 @@
set(TESTUNIT "${LIBNAME}-testrunner")
# Sources
file(GLOB SRCS_G "src/*.cpp")
POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G})
# Headers
file(GLOB_RECURSE HDRS_G "src/*.h" )
POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G})
POCO_SOURCES_AUTO_PLAT( TEST_SRCS WIN32
src/WinDriver.cpp
)
add_executable( ${TESTUNIT} ${TEST_SRCS} )
add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all)
target_link_libraries( ${TESTUNIT} PocoCppParser PocoFoundation CppUnit )
if( WIN32)
add_definitions("-D_AFXDLL")
target_link_libraries( ${TESTUNIT} WinTestRunner)
endif(WIN32)