cmake: Foundation cleanup

- add NumericString.cpp to source files
- support unbundled pcre and zlib
- add OpcomChannel to OPENVMS_SRC for later OpenVMS support
-

Reviewed-by: Roger Meier <r.meier@siemens.com>
This commit is contained in:
Pascal Bach 2014-07-09 15:52:54 +02:00
parent 0fd90ec722
commit 10b4a9c631

View File

@ -23,8 +23,8 @@ if (WIN32)
message(STATUS "Found message compiler: ${CMAKE_MC_COMPILER}")
mark_as_advanced(CMAKE_MC_COMPILER)
endif(WIN32)
set( BASE_SRCS
set( BASE_SRCS
src/ASCIIEncoding.cpp
src/Ascii.cpp
src/AtomicCounter.cpp
@ -108,7 +108,7 @@ set( BASE_SRCS
src/NullStream.cpp
src/NumberFormatter.cpp
src/NumberParser.cpp
# src/OpcomChannel.cpp
src/NumericString.cpp
src/Path.cpp
src/PatternFormatter.cpp
src/Pipe.cpp
@ -176,71 +176,95 @@ set( BASE_SRCS
src/Windows1250Encoding.cpp
src/Windows1251Encoding.cpp
src/Windows1252Encoding.cpp
src/adler32.c
src/compress.c
src/crc32.c
src/deflate.c
src/infback.c
src/inffast.c
src/inflate.c
src/inftrees.c
src/pcre_chartables.c
src/pcre_compile.c
src/pcre_exec.c
src/pcre_fullinfo.c
src/pcre_globals.c
src/pcre_maketables.c
src/pcre_newline.c
src/pcre_ord2utf8.c
src/pcre_study.c
src/pcre_tables.c
src/pcre_try_flipped.c
src/pcre_ucd.c
src/pcre_valid_utf8.c
src/pcre_xclass.c
src/pocomsg.mc
src/trees.c
src/zutil.c
)
# If POCO_UNBUNDLED is enabled we try to find the required packages
# The configuration will fail if the packages are not found
if (POCO_UNBUNDLED)
find_package(PCRE REQUIRED)
set(SYSLIBS ${SYSLIBS} ${PCRE_LIBRARIES})
include_directories(${PCRE_INCLUDE_DIRS})
find_package(ZLIB REQUIRED)
set(SYSLIBS ${SYSLIBS} ${ZLIB_LIBRARIES})
include_directories(${ZLIB_INCLUDE_DIRS})
else()
# PCRE
list(APPEND BASE_SRCS
src/pcre_chartables.c
src/pcre_compile.c
src/pcre_exec.c
src/pcre_fullinfo.c
src/pcre_globals.c
src/pcre_maketables.c
src/pcre_newline.c
src/pcre_ord2utf8.c
src/pcre_study.c
src/pcre_tables.c
src/pcre_try_flipped.c
src/pcre_ucd.c
src/pcre_valid_utf8.c
src/pcre_xclass.c
)
# ZLIB
list(APPEND BASE_SRCS
src/adler32.c
src/compress.c
src/crc32.c
src/deflate.c
src/infback.c
src/inffast.c
src/inflate.c
src/inftrees.c
src/trees.c
src/zutil.c
)
endif (POCO_UNBUNDLED)
set(WIN_SRCS
src/EventLogChannel.cpp
src/WindowsConsoleChannel.cpp
)
if (WIN32)
set(RES_SRCS ${CMAKE_SOURCE_DIR}/Foundation/src/pocomsg.h)
set_source_files_properties(${RES_SRCS} PROPERTIES GENERATED true)
add_custom_command(
OUTPUT ${RES_SRCS}
DEPENDS ${CMAKE_SOURCE_DIR}/Foundation/src/pocomsg.mc
COMMAND ${CMAKE_MC_COMPILER}
ARGS
-h ${CMAKE_SOURCE_DIR}/Foundation/src
-r ${CMAKE_SOURCE_DIR}/Foundation/src
${CMAKE_SOURCE_DIR}/Foundation/src/pocomsg.mc
VERBATIM # recommended: p260
)
list(APPEND WIN_SRCS ${RES_SRCS})
set(RES_SRCS ${CMAKE_SOURCE_DIR}/Foundation/src/pocomsg.h)
set_source_files_properties(${RES_SRCS} PROPERTIES GENERATED true)
add_custom_command(
OUTPUT ${RES_SRCS}
DEPENDS ${CMAKE_SOURCE_DIR}/Foundation/src/pocomsg.mc
COMMAND ${CMAKE_MC_COMPILER}
ARGS
-h ${CMAKE_SOURCE_DIR}/Foundation/src
-r ${CMAKE_SOURCE_DIR}/Foundation/src
${CMAKE_SOURCE_DIR}/Foundation/src/pocomsg.mc
VERBATIM # recommended: p260
)
list(APPEND WIN_SRCS ${RES_SRCS})
endif (WIN32)
set(LIN_SRCS
src/SyslogChannel.cpp
)
# TODO: Use this sources somewhere if built on OpenVMS
set(OPENVMS_SRCS
src/OpcomChannel.cpp
)
if(CMAKE_SYSTEM MATCHES "Windows")
set(SRCS ${BASE_SRCS} ${WIN_SRCS})
add_definitions( -DPCRE_STATIC -DFoundation_EXPORTS)
set(SYSLIBS ${SYSLIBS} iphlpapi)
set(SRCS ${BASE_SRCS} ${WIN_SRCS})
add_definitions( -DPCRE_STATIC -DFoundation_EXPORTS)
set(SYSLIBS ${SYSLIBS} iphlpapi)
else (CMAKE_SYSTEM MATCHES "Windows")
set(SRCS ${BASE_SRCS} ${LIN_SRCS})
add_definitions( -DPCRE_STATIC)
set(SRCS ${BASE_SRCS} ${LIN_SRCS})
add_definitions( -DPCRE_STATIC)
endif(CMAKE_SYSTEM MATCHES "Windows")
add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} )
set_target_properties( ${LIBNAME} PROPERTIES VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
if (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")
set_target_properties( ${LIBNAME} PROPERTIES LINK_FLAGS "-library=stlport4")
set_target_properties( ${LIBNAME} PROPERTIES LINK_FLAGS "-library=stlport4")
endif (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")
target_link_libraries( ${LIBNAME} ${SYSLIBS})
@ -249,7 +273,7 @@ install(
DESTINATION include
PATTERN ".svn" EXCLUDE
)
install(
TARGETS ${LIBNAME}
LIBRARY DESTINATION lib${LIB_SUFFIX}