diff options
author | Eike Ziller <eike.ziller@qt.io> | 2020-05-15 16:25:49 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2020-05-18 11:18:26 +0000 |
commit | 3c535503cbb3eb4cf91f8f861e47e1f909a59a3f (patch) | |
tree | ee7491dcf003f224fa0c7ea6c38f67a056dad21e /cmake/QtCreatorAPI.cmake | |
parent | 90612d14c77d47495057b59b538d9fd2f6e7150a (diff) | |
download | qt-creator-3c535503cbb3eb4cf91f8f861e47e1f909a59a3f.tar.gz |
CMake build: Avoid using extend_qtc_target directly
Also add a extend_qtc_test which checks if the test is known.
Change-Id: Idd3b3a02ac61fce2622cb8681233cfbd96a77bc4
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Diffstat (limited to 'cmake/QtCreatorAPI.cmake')
-rw-r--r-- | cmake/QtCreatorAPI.cmake | 77 |
1 files changed, 7 insertions, 70 deletions
diff --git a/cmake/QtCreatorAPI.cmake b/cmake/QtCreatorAPI.cmake index a9ceebc8dc..99247391f8 100644 --- a/cmake/QtCreatorAPI.cmake +++ b/cmake/QtCreatorAPI.cmake @@ -460,76 +460,6 @@ function(add_qtc_plugin target_name) endif() endfunction() -function(extend_qtc_target target_name) - cmake_parse_arguments(_arg - "" - "SOURCES_PREFIX;FEATURE_INFO" - "CONDITION;DEPENDS;PUBLIC_DEPENDS;DEFINES;PUBLIC_DEFINES;INCLUDES;PUBLIC_INCLUDES;SOURCES;EXPLICIT_MOC" - ${ARGN} - ) - - if (${_arg_UNPARSED_ARGUMENTS}) - message(FATAL_ERROR "extend_qtc_target had unparsed arguments") - endif() - - condition_info(_extra_text _arg_CONDITION) - if (NOT _arg_CONDITION) - set(_arg_CONDITION ON) - endif() - if (${_arg_CONDITION}) - set(_feature_enabled ON) - else() - set(_feature_enabled OFF) - endif() - if (_arg_FEATURE_INFO) - add_feature_info(${_arg_FEATURE_INFO} _feature_enabled "${_extra_text}") - endif() - if (NOT _feature_enabled) - return() - endif() - - add_qtc_depends(${target_name} - PRIVATE ${_arg_DEPENDS} - PUBLIC ${_arg_PUBLIC_DEPENDS} - ) - target_compile_definitions(${target_name} - PRIVATE ${_arg_DEFINES} - PUBLIC ${_arg_PUBLIC_DEFINES} - ) - target_include_directories(${target_name} PRIVATE ${_arg_INCLUDES}) - - set_public_includes(${target_name} "${_arg_PUBLIC_INCLUDES}") - - if (_arg_SOURCES_PREFIX) - foreach(source IN LISTS _arg_SOURCES) - list(APPEND prefixed_sources "${_arg_SOURCES_PREFIX}/${source}") - endforeach() - - if (NOT IS_ABSOLUTE ${_arg_SOURCES_PREFIX}) - set(_arg_SOURCES_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/${_arg_SOURCES_PREFIX}") - endif() - target_include_directories(${target_name} PRIVATE $<BUILD_INTERFACE:${_arg_SOURCES_PREFIX}>) - - set(_arg_SOURCES ${prefixed_sources}) - endif() - target_sources(${target_name} PRIVATE ${_arg_SOURCES}) - - if (APPLE AND BUILD_WITH_PCH) - foreach(source IN LISTS _arg_SOURCES) - if (source MATCHES "^.*\.mm$") - set_source_files_properties(${source} PROPERTIES SKIP_PRECOMPILE_HEADERS ON) - endif() - endforeach() - endif() - - set_public_headers(${target_name} "${_arg_SOURCES}") - - foreach(file IN LISTS _arg_EXPLICIT_MOC) - set_explicit_moc(${target_name} "${file}") - endforeach() - -endfunction() - function(extend_qtc_plugin target_name) qtc_plugin_enabled(_plugin_enabled ${target_name}) if (NOT _plugin_enabled) @@ -548,6 +478,13 @@ function(extend_qtc_library target_name) extend_qtc_target(${target_name} ${ARGN}) endfunction() +function(extend_qtc_test target_name) + if (NOT (target_name IN_LIST __QTC_TESTS)) + message(FATAL_ERROR "extend_qtc_test: Unknown test target \"${name}\"") + endif() + extend_qtc_target(${target_name} ${ARGN}) +endfunction() + function(add_qtc_executable name) cmake_parse_arguments(_arg "SKIP_INSTALL;SKIP_TRANSLATION;ALLOW_ASCII_CASTS" "DESTINATION;COMPONENT" |