[CMake] ADD_CUSTOM_COMMAND in different CMakeLists.txt
Maik Beckmann
maikbeckmann at gmx.de
Thu Oct 26 18:02:16 EDT 2006
Hello!
I' got a little problem which I like do describe.
Given the structure...
Project_dir:
- file: main_dummy.ccg
- file: CMakeLists.txt
- dir: mydir
mydir:
- file: CMakeLists.txt
----------------------------------------------------------
Where the contents are...
Project_dir/main_dummy:
<file>
int main()
{
return 0;
}
</file>
Project_dir/CMakeLists.txt
<file>
project(myproject)
add_custom_command(
OUTPUT ${PROJECT_SOURCE_DIR}/main.cc
COMMAND ${CMAKE_COMMAND} -E copy
${PROJECT_SOURCE_DIR}/main_dummy.ccg
${PROJECT_SOURCE_DIR}/main.cc
DEPENDS ${PROJECT_SOURCE_DIR}/main_dummy.ccg )
add_subdirectory(mydir)
</file>
Project_dir/mydir/CMakeLists.txt
<file>
add_executable(test ${PROJECT_SOURCE_DIR}/main.cc )
</file>
-------------------------------------------------------
I'm at Project_dir and creating a build directory
mkdir build && cd build
and run
cmake ../
This is what cmake says:
<output>
CMake Error: Cannot find source file
"/home/maik/Eigene-Dateien/Programmierung/C
++/Sandkasten/libgnomevfsmm-2.16.0/cmake-extensions/generate_files/main.cc" for target "test"
Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .h
++ .hm .hpp .hxx .in .txx
-- Configuring done
</output>
If I put the >>add_custom_command<< into
Project_dir/mydir/CMakeLists.txt everything works fine. Is this a
limitation of cmake?
Regards, Maik
More information about the CMake
mailing list