aboutsummaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/cmake.d/03-macros.cmake18
1 files changed, 13 insertions, 5 deletions
diff --git a/cmake/cmake.d/03-macros.cmake b/cmake/cmake.d/03-macros.cmake
index c1ed23c..efe3128 100644
--- a/cmake/cmake.d/03-macros.cmake
+++ b/cmake/cmake.d/03-macros.cmake
@@ -124,6 +124,15 @@ 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)
@@ -300,14 +309,12 @@ macro(project_targets_populate)
set(PACKAGE_TEST_DATADIR ${PROJECT_PKG_TEST_DIR}/${DATADIR})
if(NOT ${CMAKE_BUILD_TYPE} STREQUAL "RELEASE")
- 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}
+ add_custom_target(populate
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_command(OUTPUT ${PACKAGE_BINDIR} ${PACKAGE_ETCDIR} ${PACKAGE_LIBDIR} ${PACKAGE_HTTPDIR} ${PACKAGE_DATADIR}
+ add_custom_target(populate
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
@@ -546,7 +553,8 @@ macro(wgt_package_build)
COMMAND ${packCMDTest}
)
- if(NOT ${CMAKE_BUILD_TYPE} STREQUAL "RELEASE")
+ PROJECT_HAS_TESTS()
+ if(NOT ${CMAKE_BUILD_TYPE} STREQUAL "RELEASE" AND HAS_TESTS)
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()