<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
<br>
<br>
<blockquote cite="mid200612210021.40832.axel.roebel@ircam.fr"
 type="cite">
  <pre wrap="">On Wednesday 20 December 2006 23:38, Mike Jackson wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">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})
    </pre>
  </blockquote>
  <pre wrap=""><!---->
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})
  </pre>
</blockquote>
>From the man pages:<br>
<br>
SUBDIRS<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Add a list of subdirectories to the build.<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SUBDIRS(dir1&nbsp;&nbsp;&nbsp; dir2&nbsp;&nbsp;&nbsp;&nbsp; ...[EXCLUDE_FROM_ALL&nbsp;&nbsp;&nbsp;&nbsp; exclude_dir1<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exclude_dir2 ...] [PREORDER] )<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Add&nbsp; a list of subdirectories to the build. <b>The
ADD_SUBDIRECTORY<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; command should be used instead of SUBDIRS although SUBDIRS&nbsp; will<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; still&nbsp; work.<br>
<br>
</b>So you should not continue to use SUBDIRS and use ADD_SUBDIRECTORY
as Axel does.<br>
<br>
-Sylvain<br>
</body>
</html>