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

Timo Rumland cr at olympclan.de
Sun Nov 5 04:44:55 EST 2006


Hello Alex,

> I see two things which might cause problems:

> in the add_executable() calls you should not use any system specific
> prefix/suffix, i.e. use only "hello" instead of "hello.exe".
> Otherwise on UNIX also a hello.exe will be created while on Windows
> you might even end up with a hello.exe.exe maybe.

thanks, I will just use "hello" as the executable name.

> And it is no good idea to create to executables (targets) with the
> same name. So just name your two executables differently. If the
> resulting binaries really have to have the same name, use
> SET_TARGET_PROPERTIES(...OUTPUT_NAME...)

Well, I think that's the problem. I don't want to habe two
executables, I just want to compile "hello.cpp" and "print.cpp" and
link them together to one executable, that is "./hello".

Maybe my CMakeLists.txt file is wrong for the folder where "print.cpp"
and "print.h" is placed (the output dir)? I just want to tell cmake,
that there is a subdir (output) with two files (print.*) in it that
must be compiled. At the end, the files must be linked to create only
one executable out of it.

So, what must be the content of the CMakeLists.txt file in the output
directory?


Thanks a lot for your help



More information about the CMake mailing list