diff options
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/cmake.d/01-build_options.cmake | 17 | ||||
-rw-r--r-- | cmake/cmake.d/03-macros.cmake | 32 |
2 files changed, 17 insertions, 32 deletions
diff --git a/cmake/cmake.d/01-build_options.cmake b/cmake/cmake.d/01-build_options.cmake index 502b6bd..72a3161 100644 --- a/cmake/cmake.d/01-build_options.cmake +++ b/cmake/cmake.d/01-build_options.cmake @@ -87,25 +87,18 @@ endforeach() ################################################## set(PROFILING_COMPILE_OPTIONS -g -O0 -pg -Wp,-U_FORTIFY_SOURCE CACHE STRING "Compilation flags for PROFILING build type.") set(DEBUG_COMPILE_OPTIONS -g -ggdb CACHE STRING "Compilation flags for DEBUG build type.") +set(TEST_COMPILE_OPTIONS -g -ggdb CACHE STRING "Compilation flags for TEST build type.") set(COVERAGE_COMPILE_OPTIONS -g --coverage CACHE STRING "Compilation flags for COVERAGE build type.") -set(RELEASE_COMPILE_OPTIONS -O2 - -pipe - -D_FORTIFY_SOURCE=2 - -fstack-protector-strong - -Wformat -Wformat-security - -Werror=format-security - -feliminate-unused-debug-types - -Wl,-O1 - -Wl,--hash-style=gnu - -Wl,--as-needed - -fstack-protector-strong - -Wl,-z,relro,-z,now CACHE STRING "Compilation flags for RELEASE build type. This is a copy of default Yocto build compile flags.") +set(RELEASE_COMPILE_OPTIONS -O2 -D_FORTIFY_SOURCE=2 CACHE STRING "Compilation flags for RELEASE build type.") foreach(option ${PROFILING_COMPILE_OPTIONS}) add_compile_options($<$<CONFIG:PROFILING>:${option}>) endforeach() foreach(option ${DEBUG_COMPILE_OPTIONS}) add_compile_options($<$<CONFIG:DEBUG>:${option}>) endforeach() +foreach(option ${TEST_COMPILE_OPTIONS}) + add_compile_options($<$<CONFIG:TEST>:${option}>) +endforeach() foreach(option ${COVERAGE_COMPILE_OPTIONS}) add_compile_options($<$<CONFIG:COVERAGE>:${option}>) endforeach() diff --git a/cmake/cmake.d/03-macros.cmake b/cmake/cmake.d/03-macros.cmake index efe3128..6dd9d0a 100644 --- a/cmake/cmake.d/03-macros.cmake +++ b/cmake/cmake.d/03-macros.cmake @@ -124,15 +124,6 @@ macro(PROJECT_TARGET_ADD TARGET_NAME) set(TARGET_NAME ${TARGET_NAME}) endmacro(PROJECT_TARGET_ADD) -macro(PROJECT_HAS_TESTS) - foreach(T ${PROJECT_TARGETS}) - get_target_property(TL ${T} "LABELS") - if(TL AND "${TL}" MATCHES "^TEST-") - set(HAS_TESTS TRUE) - endif() - endforeach() -endmacro() - macro(PROJECT_PKGDEP_ADD PKG_NAME) set_property(GLOBAL APPEND PROPERTY PROJECT_PKG_DEPS ${PKG_NAME}) endmacro(PROJECT_PKGDEP_ADD) @@ -308,13 +299,15 @@ macro(project_targets_populate) set(PACKAGE_TEST_HTTPDIR ${PROJECT_PKG_TEST_DIR}/${HTTPDIR}) set(PACKAGE_TEST_DATADIR ${PROJECT_PKG_TEST_DIR}/${DATADIR}) - if(NOT ${CMAKE_BUILD_TYPE} STREQUAL "RELEASE") - add_custom_target(populate + if(${CMAKE_BUILD_TYPE} STREQUAL "TEST") + add_custom_command(OUTPUT ${PACKAGE_BINDIR} ${PACKAGE_ETCDIR} ${PACKAGE_LIBDIR} ${PACKAGE_HTTPDIR} ${PACKAGE_DATADIR} ${PACKAGE_TEST_BINDIR} ${PACKAGE_TEST_ETCDIR} ${PACKAGE_TEST_LIBDIR} ${PACKAGE_TEST_HTTPDIR} ${PACKAGE_TEST_DATADIR} COMMAND mkdir -p ${PACKAGE_BINDIR} ${PACKAGE_ETCDIR} ${PACKAGE_LIBDIR} ${PACKAGE_HTTPDIR} ${PACKAGE_DATADIR} COMMAND mkdir -p ${PACKAGE_TEST_BINDIR} ${PACKAGE_TEST_ETCDIR} ${PACKAGE_TEST_LIBDIR} ${PACKAGE_TEST_HTTPDIR} ${PACKAGE_TEST_DATADIR}) + add_custom_target(populate DEPENDS ${PACKAGE_BINDIR} ${PACKAGE_ETCDIR} ${PACKAGE_LIBDIR} ${PACKAGE_HTTPDIR} ${PACKAGE_DATADIR} ${PACKAGE_TEST_BINDIR} ${PACKAGE_TEST_ETCDIR} ${PACKAGE_TEST_LIBDIR} ${PACKAGE_TEST_HTTPDIR} ${PACKAGE_TEST_DATADIR}) else() - add_custom_target(populate + add_custom_command(OUTPUT ${PACKAGE_BINDIR} ${PACKAGE_ETCDIR} ${PACKAGE_LIBDIR} ${PACKAGE_HTTPDIR} ${PACKAGE_DATADIR} COMMAND mkdir -p ${PACKAGE_BINDIR} ${PACKAGE_ETCDIR} ${PACKAGE_LIBDIR} ${PACKAGE_HTTPDIR} ${PACKAGE_DATADIR}) + add_custom_target(populate DEPENDS ${PACKAGE_BINDIR} ${PACKAGE_ETCDIR} ${PACKAGE_LIBDIR} ${PACKAGE_HTTPDIR} ${PACKAGE_DATADIR}) endif() # Dirty trick to define a default INSTALL command for app-templates handled @@ -363,7 +356,7 @@ macro(project_targets_populate) set(S ".ctlso") endif() generate_one_populate_target(${P}${OUT}${S} "${PACKAGE_LIBDIR}/plugins") - elseif(NOT ${CMAKE_BUILD_TYPE} STREQUAL "RELEASE" AND ${T} STREQUAL "TEST-PLUGIN") + elseif(${CMAKE_BUILD_TYPE} STREQUAL "TEST" AND ${T} STREQUAL "TEST-PLUGIN") if(NOT S) set(S ".ctlso") endif() @@ -396,7 +389,7 @@ macro(project_targets_populate) else() generate_one_populate_target(${P}${OUT}${S} ${PACKAGE_BINDIR}) endif() - elseif(NOT ${CMAKE_BUILD_TYPE} STREQUAL "RELEASE" AND ${T} STREQUAL "TEST-EXECUTABLE") + elseif(${CMAKE_BUILD_TYPE} STREQUAL "TEST" AND ${T} STREQUAL "TEST-EXECUTABLE") if(NOT S) set(S "") endif() @@ -408,15 +401,15 @@ macro(project_targets_populate) endif() elseif(${T} STREQUAL "HTDOCS") generate_one_populate_target(${P}${OUT} ${PACKAGE_HTTPDIR}) - elseif(NOT ${CMAKE_BUILD_TYPE} STREQUAL "RELEASE" AND ${T} STREQUAL "TEST-HTDOCS") + elseif(${CMAKE_BUILD_TYPE} STREQUAL "TEST" AND ${T} STREQUAL "TEST-HTDOCS") generate_one_populate_target(${P}${OUT} ${PACKAGE_HTTPDIR}) elseif(${T} STREQUAL "DATA" ) generate_one_populate_target(${TARGET} ${PACKAGE_DATADIR}) - elseif(NOT ${CMAKE_BUILD_TYPE} STREQUAL "RELEASE" AND ${T} STREQUAL "TEST-DATA") + elseif(${CMAKE_BUILD_TYPE} STREQUAL "TEST" AND ${T} STREQUAL "TEST-DATA") generate_one_populate_target(${TARGET} ${PACKAGE_TEST_DATADIR}) elseif(${T} STREQUAL "BINDING-CONFIG" ) generate_one_populate_target(${TARGET} ${PACKAGE_ETCDIR}) - elseif(NOT ${CMAKE_BUILD_TYPE} STREQUAL "RELEASE" AND ${T} STREQUAL "TEST-CONFIG") + elseif(${CMAKE_BUILD_TYPE} STREQUAL "TEST" AND ${T} STREQUAL "TEST-CONFIG") generate_one_populate_target(${TARGET} ${PACKAGE_TEST_ETCDIR}) endif() elseif(${CMAKE_BUILD_TYPE} MATCHES "[Dd][Ee][Bb][Uu][Gg]") @@ -515,7 +508,7 @@ macro(wgt_package_build) COMMAND cp ${CMAKE_SOURCE_DIR}/${PROJECT_APP_TEMPLATES_DIR}//test-widget/launcher.sh.in ${PROJECT_PKG_TEST_DIR}/bin/launcher ) - if(NOT ${CMAKE_BUILD_TYPE} STREQUAL "RELEASE") + if(${CMAKE_BUILD_TYPE} STREQUAL "TEST") string(TOLOWER "${PROJECT_NAME}-${CMAKE_BUILD_TYPE}" WGT_NAME) add_custom_target(packaging_wgt DEPENDS ${PROJECT_PKG_BUILD_DIR}/config.xml ${PROJECT_PKG_TEST_DIR}/test-config.xml ${PROJECT_PKG_TEST_DIR}/bin/launcher) else() @@ -553,8 +546,7 @@ macro(wgt_package_build) COMMAND ${packCMDTest} ) - PROJECT_HAS_TESTS() - if(NOT ${CMAKE_BUILD_TYPE} STREQUAL "RELEASE" AND HAS_TESTS) + if(${CMAKE_BUILD_TYPE} STREQUAL "TEST") add_custom_target(widget DEPENDS ${WGT_NAME}.wgt ${WGT_NAME}-test.wgt) set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_BINARY_DIR}/${WGT_NAME}-test.wgt") else() |