Skip to content

Commit d9c0d2b

Browse files
committed
CMake: Add support for CppParser
1 parent af1b946 commit d9c0d2b

File tree

4 files changed

+80
-0
lines changed

4 files changed

+80
-0
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ option(ENABLE_DATA_ODBC "Enable Data ODBC" ON)
8484
option(ENABLE_SEVENZIP "Enable SevenZip" ON)
8585
option(ENABLE_ZIP "Enable Zip" ON)
8686
option(ENABLE_APACHECONNECTOR "Enable ApacheConnector" ON)
87+
option(ENABLE_CPPPARSER "Enable C++ parser" ON)
8788

8889
option(FORCE_OPENSSL "Force usage of OpenSSL even under windows" OFF)
8990

@@ -249,6 +250,11 @@ if(APRUTIL_FOUND AND APACHE_FOUND)
249250
endif()
250251
endif(APRUTIL_FOUND AND APACHE_FOUND)
251252

253+
if(ENABLE_CPPPARSER)
254+
add_subdirectory(CppParser)
255+
list(APPEND Poco_COMPONENTS "CppParser")
256+
endif()
257+
252258
#############################################################
253259
# Uninstall stuff see: http://www.vtk.org/Wiki/CMake_FAQ
254260
configure_file(

CppParser/CMakeLists.txt

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
set(LIBNAME "CppParser")
2+
set(POCO_LIBNAME "Poco${LIBNAME}")
3+
4+
# Sources
5+
file(GLOB SRCS_G "src/*.cpp")
6+
POCO_SOURCES_AUTO( SRCS ${SRCS_G})
7+
8+
# Headers
9+
file(GLOB_RECURSE HDRS_G "include/*.h" )
10+
POCO_HEADERS_AUTO( SRCS ${HDRS_G})
11+
12+
add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} )
13+
add_library( "${POCO_LIBNAME}" ALIAS "${LIBNAME}")
14+
set_target_properties( "${LIBNAME}"
15+
PROPERTIES
16+
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION}
17+
OUTPUT_NAME ${POCO_LIBNAME}
18+
DEFINE_SYMBOL CppParser_EXPORTS
19+
)
20+
21+
target_link_libraries( "${LIBNAME}" Foundation)
22+
target_include_directories( "${LIBNAME}"
23+
PUBLIC
24+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
25+
$<INSTALL_INTERFACE:include>
26+
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
27+
)
28+
29+
install(
30+
DIRECTORY include/Poco
31+
DESTINATION include
32+
COMPONENT Devel
33+
PATTERN ".svn" EXCLUDE
34+
)
35+
36+
install(
37+
TARGETS "${LIBNAME}" EXPORT "${LIBNAME}Targets"
38+
LIBRARY DESTINATION lib${LIB_SUFFIX}
39+
ARCHIVE DESTINATION lib${LIB_SUFFIX}
40+
RUNTIME DESTINATION bin
41+
INCLUDES DESTINATION include
42+
)
43+
44+
POCO_GENERATE_PACKAGE("${LIBNAME}" "${LIBNAME}Targets" "lib/cmake/${PROJECT_NAME}")
45+
46+
if (ENABLE_TESTS)
47+
add_subdirectory(testsuite)
48+
endif ()
49+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
include(CMakeFindDependencyMacro)
2+
set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_LIST_DIR})
3+
find_dependency(PocoFoundation)
4+
include("${CMAKE_CURRENT_LIST_DIR}/PocoCppParserTargets.cmake")

CppParser/testsuite/CMakeLists.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
set(TESTUNIT "${LIBNAME}-testrunner")
2+
3+
# Sources
4+
file(GLOB SRCS_G "src/*.cpp")
5+
POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G})
6+
7+
# Headers
8+
file(GLOB_RECURSE HDRS_G "src/*.h" )
9+
POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G})
10+
11+
POCO_SOURCES_AUTO_PLAT( TEST_SRCS WIN32
12+
src/WinDriver.cpp
13+
)
14+
15+
add_executable( ${TESTUNIT} ${TEST_SRCS} )
16+
add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all)
17+
target_link_libraries( ${TESTUNIT} PocoCppParser PocoFoundation CppUnit )
18+
if( WIN32)
19+
add_definitions("-D_AFXDLL")
20+
target_link_libraries( ${TESTUNIT} WinTestRunner)
21+
endif(WIN32)

0 commit comments

Comments
 (0)