[CMake] ADD_SUBDIRECTORY problem
Prashanth Udupa
prashanth.udupa at gmail.com
Fri Feb 17 03:21:57 EST 2006
Hello All,
I have a project in directory XYZ. The directory has the
following structure
XYZ
- include
- sources
- examples
- example_program1
- example_program2
- example_program3
- tools
- tool1
When I use the following CMakeLists.txt file set on Linux;
run cmake and make I notice that it works as expected.
I get a libxyz.a file, xyztool, example_program1, example_program2
and example_program3 executables.
However when I use the same CMakeLists.txt file set on
Windows XP, and use cmake to generate a Visual Studio
6.0 workspace; and select Build -> Build (F7) only xyz.lib
and xyztool.exe are created. The example programs are
not compiled and linked.
I have pasted the structure of my CMakeLists.txt files below.
I dont understand this difference between Linux and Windows.
Am I missing something ? Please help.
I have a CMakeLists.txt file in XYZ which looks like this
--------------
# File: XYZ/CMakeLists.txt
PROJECT(XYZ)
INCLUDE_DIRECTORIES(
${XYZ_SOURCE_DIR}/include
)
LINK_DIRECTORIES(
${XYZ_BINARY_DIR}/
)
ADD_LIBRARY(xyz STATIC
... < all the cpp files go here >
...
...
)
ADD_SUBDIRECTORY(tools)
ADD_SUBDIRECTORY(examples)
--------------
The tools/CMakeLists.txt looks like this
--------------
# File: tools/CMakeLists.txt
ADD_SUBDIRECTORY(tool1)
--------------
And tool1/CMakeLists.txt looks like this
--------------
# File: tools/tool1/CMakeLists.txt
ADD_EXECUTABLE(xyztool
<cpp file list>
)
TARGET_LINK_LIBRARIES(xyztool xyz)
--------------
examples/CMakeLists.txt
The tools/CMakeLists.txt looks like this
--------------
# File: examples/CMakeLists.txt
ADD_SUBDIRECTORY(example_program1)
ADD_SUBDIRECTORY(example_program2)
ADD_SUBDIRECTORY(example_program3)
--------------
The example_program[123] directories have their CMakeLists.txt similar to
the tools/tool1/CMakeLists.txt file.
--------------
# File: examples/example_program1/CMakeLists.txt
ADD_EXECUTABLE(example_program1
<cpp file list>
)
TARGET_LINK_LIBRARIES(example_program1 xyz)
--------------
--------------
# File: examples/example_program2/CMakeLists.txt
ADD_EXECUTABLE(example_program2
<cpp file list>
)
TARGET_LINK_LIBRARIES(example_program2 xyz)
--------------
--------------
# File: examples/example_program1/CMakeLists.txt
ADD_EXECUTABLE(example_program3
<cpp file list>
)
TARGET_LINK_LIBRARIES(example_program3 xyz)
--------------
--
Thanks and Warm Regards,
Prashanth N Udupa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20060217/a66fbbdf/attachment.htm
More information about the CMake
mailing list