diff options
author | Brad King <brad.king@kitware.com> | 2022-04-07 14:54:16 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-04-07 14:54:30 (GMT) |
commit | 9a7d8394b17c8e655ed68cb31bf497a0ef72c34b (patch) | |
tree | 20525e1bfd52219d3be858ed294d300acde40168 | |
parent | e6a200fa9f8703d3ceb7e9f5304460bab10cbe81 (diff) | |
parent | f779f8c0ad4c16cda5a166d440915a01e986d396 (diff) | |
download | CMake-9a7d8394b17c8e655ed68cb31bf497a0ef72c34b.zip CMake-9a7d8394b17c8e655ed68cb31bf497a0ef72c34b.tar.gz CMake-9a7d8394b17c8e655ed68cb31bf497a0ef72c34b.tar.bz2 |
Merge topic 'header-sets-no-framework'
f779f8c0ad FILE_SET: Forbid adding header sets to Apple FRAMEWORK libraries
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kyle Edwards <kyle.edwards@kitware.com>
Merge-request: !7149
-rw-r--r-- | Help/command/target_sources.rst | 2 | ||||
-rw-r--r-- | Help/release/3.23.rst | 14 | ||||
-rw-r--r-- | Source/cmTargetSourcesCommand.cxx | 4 | ||||
-rw-r--r-- | Tests/RunCMake/target_sources/FileSetFramework-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/target_sources/FileSetFramework-stderr.txt | 4 | ||||
-rw-r--r-- | Tests/RunCMake/target_sources/FileSetFramework.cmake | 7 | ||||
-rw-r--r-- | Tests/RunCMake/target_sources/RunCMakeTest.cmake | 3 |
7 files changed, 34 insertions, 1 deletions
diff --git a/Help/command/target_sources.rst b/Help/command/target_sources.rst index 6ad86e3..1ad6c37 100644 --- a/Help/command/target_sources.rst +++ b/Help/command/target_sources.rst @@ -77,7 +77,7 @@ have zero or more named file sets. Each file set has a name, a type, a scope of ``INTERFACE``, ``PUBLIC``, or ``PRIVATE``, one or more base directories, and files within those directories. The only acceptable type is ``HEADERS``. The optional default file sets are named after their type. The target may not be a -custom target. +custom target or :prop_tgt:`FRAMEWORK` target. Files in a ``PRIVATE`` or ``PUBLIC`` file set are marked as source files for the purposes of IDE integration. Additionally, files in ``HEADERS`` file sets diff --git a/Help/release/3.23.rst b/Help/release/3.23.rst index 1a3f53e..257c3d5 100644 --- a/Help/release/3.23.rst +++ b/Help/release/3.23.rst @@ -264,3 +264,17 @@ Other Changes * :manual:`ccmake(1)` may now be enabled on Windows when building CMake from source. This is experimental, and so is not included in official distributions. + +Updates +======= + +Changes made since CMake 3.23.0 include the following. + +3.23.1 +------ + +* The :command:`target_sources` ``FILE_SET`` feature added in CMake 3.23.0 + does not yet place header files properly in Apple :prop_tgt:`FRAMEWORK` + targets. Pending further work in a future version of CMake, it is now + an error to add a ``FILE_SET`` of type ``HEADERS`` to such targets on + Apple platforms. diff --git a/Source/cmTargetSourcesCommand.cxx b/Source/cmTargetSourcesCommand.cxx index 43a9b3a..9173a34 100644 --- a/Source/cmTargetSourcesCommand.cxx +++ b/Source/cmTargetSourcesCommand.cxx @@ -230,6 +230,10 @@ bool TargetSourcesImpl::HandleOneFileSet( this->SetError("FILE_SETs may not be added to custom targets"); return false; } + if (this->Target->IsFrameworkOnApple()) { + this->SetError("FILE_SETs may not be added to FRAMEWORK targets"); + return false; + } bool const isDefault = args.Type == args.FileSet || (args.Type.empty() && args.FileSet[0] >= 'A' && args.FileSet[0] <= 'Z'); diff --git a/Tests/RunCMake/target_sources/FileSetFramework-result.txt b/Tests/RunCMake/target_sources/FileSetFramework-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetFramework-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetFramework-stderr.txt b/Tests/RunCMake/target_sources/FileSetFramework-stderr.txt new file mode 100644 index 0000000..ae7026a --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetFramework-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at FileSetFramework\.cmake:[0-9]+ \(target_sources\): + target_sources FILE_SETs may not be added to FRAMEWORK targets +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_sources/FileSetFramework.cmake b/Tests/RunCMake/target_sources/FileSetFramework.cmake new file mode 100644 index 0000000..d8a924f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetFramework.cmake @@ -0,0 +1,7 @@ +enable_language(C) + +add_library(lib1 SHARED lib1.c) +set_property(TARGET lib1 PROPERTY FRAMEWORK ON) +target_sources(lib1 + PUBLIC FILE_SET HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES h1.h + ) diff --git a/Tests/RunCMake/target_sources/RunCMakeTest.cmake b/Tests/RunCMake/target_sources/RunCMakeTest.cmake index d23bce1..743879e 100644 --- a/Tests/RunCMake/target_sources/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_sources/RunCMakeTest.cmake @@ -40,6 +40,9 @@ run_cmake(FileSetNoExistInstall) run_cmake(FileSetDirectories) run_cmake(FileSetCustomTarget) run_cmake(FileSetBadName) +if(APPLE) + run_cmake(FileSetFramework) +endif() set(RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0115=NEW) run_cmake(FileSetFileNoExist) |