Hi,

I'm trying to set up a project pulls in information from another CMake project 
(include dirs, libraries, etc.).  As I understand it the right thing to do is 
create a <Project>config.cmake.in in the source project and then use 
find_package in config mode to pull in the information to the dependent project.

So far things seem to be working properly but I'd like to pull the content of 
include_directories from the master project into the dependent project because 
it has to reference a few headers.  I haven't found any built in CMake variable 
that collects all the include_directory commands but I can do something like 
this:

get_property (dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY 
INCLUDE_DIRECTORIES)
foreach (dir ${dirs})
  message (STATUS "MyProject INCLUDE DIRECTORY: '${dir}'")
  list (APPEND MyProject_INCLUDE_DIRS ${dir})
endforeach ()
message( STATUS "MyProject_INCLUDE_DIRS: " ${MyProject_INCLUDE_DIRS} )

this seems to do the right thing and lists all the directories in 
include_directory() statements, but when I go to the MyProjectConfig.cmake.in 
file and have something like this:


set (MYPROJECT_INCLUDE_DIRS ${MyProject_INCLUDE_DIRS})

it doesn't get anything.  I have other statements in the 
MyProjectConfig.cmake.in file that have a similar pattern and are expanded but 
for this one I get something like this:


set (MYPROJECT_INCLUDE_DIRS )

I've used CMake for a while, generated a couple simple project scripts in the 
past but this is my first time developing a project using find_package in 
config mode.   Any suggestions would be helpful :)

Thanks!
  -William
-- 

Powered by www.kitware.com

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

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to