While packaging CMake 2.8.8 for FreeBSD, an old port of lprof [1]
started failing to build after some include headers were not found.

The relevant CMakeLists does the following:

  add_library(foo foo.c)
  set_directory_properties(
      PROPERTIES INCLUDE_DIRECTORIES "${SOME_DIRECTORY}")

foo.c includes "bar.h" which is in ${SOME_DIRECTORY}.

This used to work until commit 9106b564ae5bf0bf1c1ff4a3fca484bcfd40e183,
and the following patch can be applied to master for ctest to fail on
the IncludeDirectories test:

diff --git a/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt 
b/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt
index 2cf36f5..05065c2 100644
--- a/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt
+++ b/Tests/IncludeDirectories/TargetIncludeDirectories/CMakeLists.txt
@@ -21,6 +21,7 @@ include_directories("${CMAKE_CURRENT_BINARY_DIR}/bar")

 add_executable(TargetIncludeDirectories main.cpp)
 set_property(TARGET TargetIncludeDirectories APPEND PROPERTY 
INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/bat")
-set_property(TARGET TargetIncludeDirectories APPEND PROPERTY 
INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/foo")
+# set_property(TARGET TargetIncludeDirectories APPEND PROPERTY 
INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/foo")
+set_property(DIRECTORY PROPERTY INCLUDE_DIRECTORIES 
"${CMAKE_CURRENT_BINARY_DIR}/foo")

 include_directories("${CMAKE_CURRENT_BINARY_DIR}/baz")

Moving that set_property(DIRECTORY) call somewhere before the
add_executable() call makes the test pass.

Is this change of behaviour intentional?

Cheers.

[1] http://www.freshports.org/graphics/lprof-devel

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to