VERIFY_HEADER_SETS: Rename to VERIFY_INTERFACE_HEADER_SETS

Issue: #23448
This commit is contained in:
Kyle Edwards
2022-05-18 10:14:02 -04:00
parent 58446c84e4
commit 259c265112
35 changed files with 66 additions and 64 deletions

View File

@@ -381,7 +381,7 @@ Properties on Targets
/prop_tgt/UNITY_BUILD_CODE_BEFORE_INCLUDE
/prop_tgt/UNITY_BUILD_MODE
/prop_tgt/UNITY_BUILD_UNIQUE_ID
/prop_tgt/VERIFY_HEADER_SETS
/prop_tgt/VERIFY_INTERFACE_HEADER_SETS
/prop_tgt/VERSION
/prop_tgt/VISIBILITY_INLINES_HIDDEN
/prop_tgt/VS_CONFIGURATION_TYPE

View File

@@ -510,7 +510,7 @@ Variables that Control the Build
/variable/CMAKE_UNITY_BUILD_BATCH_SIZE
/variable/CMAKE_UNITY_BUILD_UNIQUE_ID
/variable/CMAKE_USE_RELATIVE_PATHS
/variable/CMAKE_VERIFY_HEADER_SETS
/variable/CMAKE_VERIFY_INTERFACE_HEADER_SETS
/variable/CMAKE_VISIBILITY_INLINES_HIDDEN
/variable/CMAKE_VS_GLOBALS
/variable/CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD

View File

@@ -1,25 +0,0 @@
VERIFY_HEADER_SETS
------------------
.. versionadded:: 3.24
Used to verify that all headers in a target's header sets can be included on
their own.
When this property is set to true, and the target is an object library, static
library, shared library, or executable with exports enabled, and the target
has one or more ``PUBLIC`` or ``INTERFACE`` header sets, an object library
target named ``<target_name>_verify_header_sets`` is created. This verification
target has one source file per header in the ``PUBLIC`` and ``INTERFACE``
header sets. Each source file only includes its associated header file. The
verification target links against the original target to get all of its usage
requirements. The verification target has its :prop_tgt:`EXCLUDE_FROM_ALL` and
:prop_tgt:`DISABLE_PRECOMPILE_HEADERS` properties set to true, and its
:prop_tgt:`AUTOMOC`, :prop_tgt:`AUTORCC`, :prop_tgt:`AUTOUIC`, and
:prop_tgt:`UNITY_BUILD` properties set to false.
If the header's :prop_sf:`LANGUAGE` property is set, the value of that property
is used to determine the language with which to compile the header file.
Otherwise, if the target has any C++ sources, the header is compiled as C++.
Otherwise, if the target has any C sources, the header is compiled as C.
Otherwise, the header file is not compiled.

View File

@@ -0,0 +1,25 @@
VERIFY_INTERFACE_HEADER_SETS
----------------------------
.. versionadded:: 3.24
Used to verify that all headers in a target's ``PUBLIC`` and ``INTERFACE``
header sets can be included on their own.
When this property is set to true, and the target is an object library, static
library, shared library, or executable with exports enabled, and the target
has one or more ``PUBLIC`` or ``INTERFACE`` header sets, an object library
target named ``<target_name>_verify_interface_header_sets`` is created. This
verification target has one source file per header in the ``PUBLIC`` and
``INTERFACE`` header sets. Each source file only includes its associated
header file. The verification target links against the original target to get
all of its usage requirements. The verification target has its
:prop_tgt:`EXCLUDE_FROM_ALL` and :prop_tgt:`DISABLE_PRECOMPILE_HEADERS`
properties set to true, and its :prop_tgt:`AUTOMOC`, :prop_tgt:`AUTORCC`,
:prop_tgt:`AUTOUIC`, and :prop_tgt:`UNITY_BUILD` properties set to false.
If the header's :prop_sf:`LANGUAGE` property is set, the value of that property
is used to determine the language with which to compile the header file.
Otherwise, if the target has any C++ sources, the header is compiled as C++.
Otherwise, if the target has any C sources, the header is compiled as C.
Otherwise, the header file is not compiled.

View File

@@ -1,7 +0,0 @@
verify-header-sets
------------------
* A new :prop_tgt:`VERIFY_HEADER_SETS` target property was added, which can be
used to verify that all headers in header sets can be used on their own.
* A new :variable:`CMAKE_VERIFY_HEADER_SETS` variable was added, which is used
to initialize the :prop_tgt:`VERIFY_HEADER_SETS` target property.

View File

@@ -0,0 +1,9 @@
verify-interface-header-sets
----------------------------
* A new :prop_tgt:`VERIFY_INTERFACE_HEADER_SETS` target property was added,
which can be used to verify that all headers in header sets can be used on
their own.
* A new :variable:`CMAKE_VERIFY_INTERFACE_HEADER_SETS` variable was added,
which is used to initialize the :prop_tgt:`VERIFY_INTERFACE_HEADER_SETS`
target property.

View File

@@ -1,11 +1,11 @@
CMAKE_VERIFY_HEADER_SETS
------------------------
CMAKE_VERIFY_INTERFACE_HEADER_SETS
----------------------------------
.. versionadded:: 3.24
This variable is used to initialize the :prop_tgt:`VERIFY_HEADER_SETS`
property of targets when they are created. Setting it to true
enables header set verification.
This variable is used to initialize the
:prop_tgt:`VERIFY_INTERFACE_HEADER_SETS` property of targets when they are
created. Setting it to true enables header set verification.
Projects should not set this variable, it is intended as a developer
control to be set on the :manual:`cmake(1)` command line or other

View File

@@ -8527,7 +8527,7 @@ cmGeneratorTarget::ManagedType cmGeneratorTarget::GetManagedType(
bool cmGeneratorTarget::AddHeaderSetVerification()
{
if (!this->GetPropertyAsBool("VERIFY_HEADER_SETS")) {
if (!this->GetPropertyAsBool("VERIFY_INTERFACE_HEADER_SETS")) {
return true;
}
@@ -8601,7 +8601,7 @@ bool cmGeneratorTarget::AddHeaderSetVerification()
cmMakefile::PolicyPushPop polScope(this->Makefile);
this->Makefile->SetPolicy(cmPolicies::CMP0119, cmPolicies::NEW);
verifyTarget = this->Makefile->AddLibrary(
cmStrCat(this->GetName(), "_verify_header_sets"),
cmStrCat(this->GetName(), "_verify_interface_header_sets"),
cmStateEnums::OBJECT_LIBRARY, {}, true);
}
@@ -8682,9 +8682,9 @@ std::string cmGeneratorTarget::GenerateHeaderSetVerificationFile(
}
headerFilename += source.GetLocation().GetName();
auto filename = cmStrCat(this->LocalGenerator->GetCurrentBinaryDirectory(),
'/', this->GetName(), "_verify_header_sets/",
headerFilename, extension);
auto filename = cmStrCat(
this->LocalGenerator->GetCurrentBinaryDirectory(), '/', this->GetName(),
"_verify_interface_header_sets/", headerFilename, extension);
auto* verificationSource = this->Makefile->GetOrCreateSource(filename);
verificationSource->SetProperty("LANGUAGE", language);

View File

@@ -621,7 +621,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
}
initProp("FOLDER");
initProp("VERIFY_HEADER_SETS");
initProp("VERIFY_INTERFACE_HEADER_SETS");
if (this->GetGlobalGenerator()->IsXcode()) {
initProp("XCODE_GENERATE_SCHEME");

View File

@@ -9,34 +9,34 @@ function(run_cmake_build name target)
run_cmake_command(${name}-${target}-${BUILD_CONFIG}-build ${CMAKE_COMMAND} --build . --config ${BUILD_CONFIG} --target ${target})
endfunction()
set(RunCMake_TEST_OPTIONS -DCMAKE_VERIFY_HEADER_SETS=ON)
set(RunCMake_TEST_OPTIONS -DCMAKE_VERIFY_INTERFACE_HEADER_SETS=ON)
if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug)
endif()
run_cmake(VerifyHeaderSets)
unset(RunCMake_TEST_OPTIONS)
run_cmake_build(VerifyHeaderSets static_verify_header_sets)
run_cmake_build(VerifyHeaderSets shared_verify_header_sets)
run_cmake_build(VerifyHeaderSets object_verify_header_sets)
run_cmake_build(VerifyHeaderSets interface_verify_header_sets)
run_cmake_build(VerifyHeaderSets exe_verify_header_sets)
run_cmake_build(VerifyHeaderSets export_exe_verify_header_sets)
run_cmake_build(VerifyHeaderSets none_verify_header_sets)
run_cmake_build(VerifyHeaderSets property_off_verify_header_sets)
run_cmake_build(VerifyHeaderSets private_verify_header_sets)
run_cmake_build(VerifyHeaderSets a_h_verify_header_sets)
run_cmake_build(VerifyHeaderSets dir_c_h_verify_header_sets)
run_cmake_build(VerifyHeaderSets dir_cxx_h_verify_header_sets)
run_cmake_build(VerifyHeaderSets static_verify_interface_header_sets)
run_cmake_build(VerifyHeaderSets shared_verify_interface_header_sets)
run_cmake_build(VerifyHeaderSets object_verify_interface_header_sets)
run_cmake_build(VerifyHeaderSets interface_verify_interface_header_sets)
run_cmake_build(VerifyHeaderSets exe_verify_interface_header_sets)
run_cmake_build(VerifyHeaderSets export_exe_verify_interface_header_sets)
run_cmake_build(VerifyHeaderSets none_verify_interface_header_sets)
run_cmake_build(VerifyHeaderSets property_off_verify_interface_header_sets)
run_cmake_build(VerifyHeaderSets private_verify_interface_header_sets)
run_cmake_build(VerifyHeaderSets a_h_verify_interface_header_sets)
run_cmake_build(VerifyHeaderSets dir_c_h_verify_interface_header_sets)
run_cmake_build(VerifyHeaderSets dir_cxx_h_verify_interface_header_sets)
if(NOT RunCMake_GENERATOR STREQUAL "Xcode")
run_cmake_build(VerifyHeaderSets config_verify_header_sets)
run_cmake_build(VerifyHeaderSets config_verify_interface_header_sets)
if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
set(BUILD_CONFIG Release)
run_cmake_build(VerifyHeaderSets config_verify_header_sets)
run_cmake_build(VerifyHeaderSets config_verify_interface_header_sets)
unset(BUILD_CONFIG)
endif()
endif()
run_cmake_build(VerifyHeaderSets lang_test_c_verify_header_sets)
run_cmake_build(VerifyHeaderSets lang_test_cxx_verify_header_sets)
run_cmake_build(VerifyHeaderSets lang_test_c_verify_interface_header_sets)
run_cmake_build(VerifyHeaderSets lang_test_cxx_verify_interface_header_sets)

View File

@@ -1,5 +1,5 @@
function(check_file target filename)
set(full_filename "${RunCMake_TEST_BINARY_DIR}/${target}_verify_header_sets/${filename}")
set(full_filename "${RunCMake_TEST_BINARY_DIR}/${target}_verify_interface_header_sets/${filename}")
if(NOT EXISTS "${full_filename}")
string(APPEND RunCMake_TEST_FAILED "File ${full_filename} should exist but does not\n")
set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)

View File

@@ -27,7 +27,7 @@ add_library(none STATIC lib.c)
add_library(property_off STATIC lib.c)
target_sources(property_off INTERFACE FILE_SET HEADERS FILES a.h dir/c.h dir/cxx.h)
set_property(TARGET property_off PROPERTY VERIFY_HEADER_SETS OFF)
set_property(TARGET property_off PROPERTY VERIFY_INTERFACE_HEADER_SETS OFF)
add_library(private STATIC lib.c)
target_sources(private PRIVATE FILE_SET HEADERS FILES a.h dir/c.h dir/cxx.h)