[CMake] Please help with a simple Example, VS 8 project

Timo Rumland cr at olympclan.de
Sat Nov 4 15:42:07 EST 2006


Hallo,

I'm fairly new to cmake. I have set up a small source tree for testing
purposes and I try to generate a Visual Studio 8 project with cmake.

The file system looks like this:

Source-root is "src" with the following files:

  hello.cpp
  CMakeLists.txt

In the "src" dir, there is one subdir "output" with the following
files:

  print.cpp
  print.h
  CMakeLists.txt


So I habe only two CMakeLists.txt files. The hello.cpp is my main
application that uses a function declared and defined in
"output/print.cpp" and "output/print.h".

The content of the first cmake input file is:

  PROJECT(HelloWorld)
  ADD_SUBDIRECTORY(output)
  ADD_EXECUTABLE(hello.exe hello.cpp)

The content of the second cmake input file (in the "output" dir) is:

  ADD_EXECUTABLE(hello.exe print.cpp)


When I run cmake, it generates a Visual Studio 8 project, but in that
project, the file "print.cpp" is missing.

What have I done wrong?


Thanks a lot for your help

Ben



More information about the CMake mailing list