On 11/12/2011 02:48 PM, YunQiang Su wrote:
> I do an cmake program, but encount an stranger problem.
>
> 1. mkdir tmp; cd tmp
> 2. tar -zxvf ../cmake-test.tar.gz
> 3. mkdir build; cd build
> 4. cmake ..; make
>
> I got an error:
> /usr/bin/gcc -o tcl2c++ -rdynamic
> gcc: fatal error: no input files
>
> Then
> 1. cd ..
> 1. head -51 CMakeLists.txt >CMakeLists.txt.tmp
> 2. mv CMakeLists.txt.tmp CMakeLists.txt
> 3. cd build
> 4. rm -fr *
> 5. cmake ..; make
>
> It works now.
>
> Why?
Because of the MAIN_DEPENDENCY clause in the custom command; it's just
meant as a hint for Visual Studio, but not to establish a dependency,
and apparently, the Makefile generators are tangled when seeing this
clause. Actually, you don't need to explicitly declare a dependency
on the tcl2c++ executable at all; using the target name suffices.
The attached patch makes your project build on my system.
Regards,
Michael
--- CMakeLists.txt.bak 2011-11-13 01:51:16.981958217 +0100
+++ CMakeLists.txt 2011-11-13 01:51:55.492364967 +0100
@@ -95,16 +95,13 @@
set(CONSOLE_FILES ${LIBRARY_TK}/console.tcl)
-set(TCL2CPP ${CMAKE_CURRENT_BINARY_DIR}/tcl2c++)
-
add_custom_command(OUTPUT embedded-tcl.cc embedded-tk.cc embedded-tclobj.cc
- COMMAND ${TCL2CPP} ARGS et_tcl ${TCL_LIBRARY_FILES} > embedded-tcl.cc
+ COMMAND tcl2c++ et_tcl ${TCL_LIBRARY_FILES} > embedded-tcl.cc
COMMAND "sed -i -e 's/package require -exact T/package require T/g' embedded-tcl.cc"
- COMMAND ${TCL2CPP} ARGS et_tk ${TK_LIBRARY_FILES} > embedded-tk.cc
+ COMMAND tcl2c++ et_tk ${TK_LIBRARY_FILES} > embedded-tk.cc
COMMAND "sed -i -e 's/package require -exact T/package require T/g' embedded-tk.cc"
- COMMAND ${TCL2CPP} ARGS et_tclobject tcl-object.tcl tcl-import.tcl tcl-http.tcl > embedded-tclobj.cc
- COMMAND ${TCL2CPP} ARGS et_console ${CONSOLE_FILES} > embedded-console.cc
- MAIN_DEPENDENCY tcl2c++
+ COMMAND tcl2c++ et_tclobject tcl-object.tcl tcl-import.tcl tcl-http.tcl > embedded-tclobj.cc
+ COMMAND tcl2c++ et_console ${CONSOLE_FILES} > embedded-console.cc
)
#pkg_check_modules(OTCL REQUIRED otcl)
--
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake