[cmake-developers] set_property(DIRECTORY) regression ?
Brad King
brad.king at kitware.com
Tue May 15 10:39:39 EDT 2012
On 5/14/2012 5:18 PM, Alexander Neundorf wrote:
> This is the output I get when running the attachec example with cmake
> 2.6.4 and 2.8.0:
The behavior of properties did not change. There was a
bug in CMake 2.6 that was fixed here:
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=21fc04ef
The patch below works around this bug in 2.6 and shows
that the behavior is the same for 2.6 and 2.8 in terms
of the property inheritance.
Directory properties are not inherited by default. The
define_property() command may be used to change that for
user-defined properties by using the INHERITED option:
http://www.cmake.org/cmake/help/v2.8.8/cmake.html#command:define_property
I've never used that in a real project though.
-Brad
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3fbf3a4..7c465c4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,6 +6,7 @@ if (NOT _qt5CoreTargetExists)
set_property(DIRECTORY PROPERTY _Qt5Core_target TRUE)
message(STATUS "DF: Qt5CoreConfig.cmake add_library(Qt5::Core SHARED IMPORTED)")
endif()
+set(_qt5CoreTargetExists "")
get_property(_qt5CoreTargetExists DIRECTORY PROPERTY _Qt5Core_target)
message(STATUS "ex 2: ${_qt5CoreTargetExists}")
@@ -13,5 +14,6 @@ if (NOT _qt5CoreTargetExists)
set_property(DIRECTORY PROPERTY _Qt5Core_target TRUE)
message(STATUS "DF: Qt5CoreConfig.cmake add_library(Qt5::Core SHARED IMPORTED)")
endif()
+set(_qt5CoreTargetExists "")
add_subdirectory(sub)
More information about the cmake-developers
mailing list