On Wednesday 20 December 2006 23:38, Mike Jackson wrote:
> So in Project B's CMakeLists.txt file I have:
> ....
> SUBDIRS(${PROJECT_SOURCE_DIR}/Project_A)
> ....
> ADD_EXECUTABLE( MyProgram ${SOURCES})
> TARGET_LINK_LIBRARIES( MyProgram ${A_LIB_OUTPUT_NAME})

As far as I understand it variables defined in the main directory 
(=CMakeLists.txt) will be defined 
in the sub directory (=CMakeLists.txt), BUT, variables defined in sub 
directories will NOT be 
defined in the main directory This creates scopes for variables  like in most 
other programming languages.

so this should do it. (It does for me, however I use ADD_SUBDIRECTORY)

SUBDIRS(${PROJECT_SOURCE_DIR}/Project_A)
GET_DIRECTORY_PROPERTY(outvar DIRECTORY ${PROJECT_SOURCE_DIR}/Project_A 
DEFINITION A_LIB_OUTPUT_NAME)

ADD_EXECUTABLE( MyProgram ${SOURCES})
TARGET_LINK_LIBRARIES( MyProgram ${outvar})


-- 
Axel Roebel
IRCAM Analysis/Synthesis Team
Phone: ++33-1-4478 4845 | Fax: ++33-1-4478 1540
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to