cmake improvements: test and samples are from now disabled by default, you can enable this option with cmdline option to cmake: '-DENABLE_TESTS=1'

minimum required CMAKE version is 2.6 from now
This commit is contained in:
Marian Krivos 2011-01-22 11:46:03 +00:00
parent 96b0296969
commit 0ac146cb9e
16 changed files with 105 additions and 32 deletions

View File

@ -19,4 +19,6 @@ set_target_properties( ${LIBNAMED}
SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
target_link_libraries( ${LIBNAMED} )
if (ENABLE_TESTS)
add_subdirectory(samples)
endif ()

View File

@ -1,9 +1,9 @@
PROJECT(poco)
PROJECT(Poco)
cmake_minimum_required(VERSION 2.4.8)
cmake_minimum_required(VERSION 2.6.0)
set(CPACK_PACKAGE_VERSION_MAJOR "1")
set(CPACK_PACKAGE_VERSION_MINOR "3")
set(CPACK_PACKAGE_VERSION_MINOR "4")
set(CPACK_PACKAGE_VERSION_PATCH "99")
SET(COMPLETE_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
SET(RELEASE_NAME "Unstable-trunk")
@ -13,19 +13,28 @@ SET(PROJECT_VERSION ${COMPLETE_VERSION})
set(DEBUG_CXX_FLAGS "${COMMON_CXX} ${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
set(RELEASE_CXX_FLAGS "${COMMON_CXX} ${CMAKE_CXX_FLAGS_MINSIZEREL}")
option(ENABLE_TESTS
"Set to OFF|ON (default is OFF) to control build of POCO tests & samples" OFF)
option(POCO_STATIC
"Set to OFF|ON (default is OFF) to control build of POCO as STATIC library" OFF)
# Uncomment from next two lines to force statitc or dynamic library, default is autodetection
if(POCO_STATIC)
set( LIB_MODE STATIC )
message(STATUS "Building static libraries")
else(POCO_STATIC)
set( LIB_MODE SHARED )
message(STATUS "Building dynamic libraries")
endif(POCO_STATIC)
# whether unit tests should be build
SET (ENABLE_TESTS FALSE CACHE BOOL "Build unit tests?")
IF (ENABLE_TESTS)
include(CTest)
ENABLE_TESTING()
ENDIF (ENABLE_TESTS)
message(STATUS "Building with unittests & samples")
ELSE ()
message(STATUS "Building without tests & samples")
ENDIF ()
# Set local include path
include_directories( CppUnit/include Foundation/include XML/include Net/include NetSSL_OpenSSL/include Util/include Data/include WebWidgets/include Zip/include Crypto/include)
@ -75,7 +84,10 @@ if (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")
add_definitions( -D_BSD_SOURCE -library=stlport4)
endif (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")
IF (ENABLE_TESTS)
add_subdirectory(CppUnit)
ENDIF ()
add_subdirectory(Foundation)
add_subdirectory(XML)
add_subdirectory(Util)
@ -116,3 +128,8 @@ SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "/usr/local")
INCLUDE(CPack)
message(STATUS "CMake ${CMAKE_VERSION} successfully configured ${PROJECT_NAME} using ${CMAKE_GENERATOR} generator")
message(STATUS "XXX: CMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}")
message(STATUS "XXX: CMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG}")
message(STATUS "XXX: CMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE}")

View File

@ -30,5 +30,7 @@ install(
DESTINATION lib
)
if (ENABLE_TESTS)
add_subdirectory(samples)
add_subdirectory(testsuite)
endif ()

View File

@ -50,5 +50,7 @@ else ()
endif ()
endif()
if (ENABLE_TESTS)
add_subdirectory(samples)
add_subdirectory(testsuite)
endif ()

View File

@ -34,4 +34,6 @@ install(
DESTINATION lib
)
if (ENABLE_TESTS)
add_subdirectory(testsuite)
endif ()

View File

@ -47,4 +47,6 @@ install(
DESTINATION lib
)
if (ENABLE_TESTS)
add_subdirectory(testsuite)
endif ()

View File

@ -33,4 +33,7 @@ install(
DESTINATION lib
)
if (ENABLE_TESTS)
add_subdirectory(testsuite)
endif ()

View File

@ -214,5 +214,8 @@ install(
DESTINATION lib
)
if (ENABLE_TESTS)
add_subdirectory( samples )
add_subdirectory( testsuite )
endif ()

View File

@ -45,5 +45,8 @@ install(
DESTINATION lib
)
if (ENABLE_TESTS)
add_subdirectory(samples)
add_subdirectory(testsuite)
endif ()

View File

@ -28,5 +28,8 @@ install(
DESTINATION lib
)
if (ENABLE_TESTS)
add_subdirectory(samples)
add_subdirectory(testsuite)
endif ()

View File

@ -67,5 +67,7 @@ install(
DESTINATION lib
)
add_subdirectory( testsuite )
if (ENABLE_TESTS)
add_subdirectory(samples)
add_subdirectory(testsuite)
endif ()

View File

@ -31,4 +31,7 @@ install(
add_subdirectory( ExtJS )
if (ENABLE_TESTS)
add_subdirectory(testsuite)
endif ()

View File

@ -33,5 +33,8 @@ install(
DESTINATION lib
)
if (ENABLE_TESTS)
add_subdirectory(samples)
#add_subdirectory( testsuite )
add_subdirectory(testsuite)
endif ()

View File

@ -0,0 +1,20 @@
set( TEST_SRCS
src/Driver.cpp
src/ExtJSTest.cpp
src/ExtJSTest.h
src/ExtJSTestSuite.cpp
src/ExtJSTestSuite.h
)
#include_directories()
set( WIN_TEST_SRCS
src/WinDriver.cpp
)
set(TESTUNIT "${LIBNAME}-testrunner")
add_executable( ${TESTUNIT} ${TEST_SRCS} )
set_target_properties( ${TESTUNIT} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} )
target_link_libraries( ${TESTUNIT} PocoExtJS PocoWebWidgets PocoNet PocoUtil PocoXML PocoFoundation CppUnit)

View File

@ -30,5 +30,8 @@ install(
DESTINATION lib
)
if (ENABLE_TESTS)
add_subdirectory(samples)
add_subdirectory(testsuite)
endif ()

View File

@ -28,5 +28,8 @@ install(
DESTINATION lib
)
if (ENABLE_TESTS)
add_subdirectory(samples)
add_subdirectory(testsuite)
endif ()