MantisBT - CMake | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0011043 | CMake | CMake | public | 2010-07-27 08:06 | 2011-04-04 12:00 |
Reporter | ovm | ||||
Assigned To | David Cole | ||||
Priority | normal | Severity | major | Reproducibility | always |
Status | closed | Resolution | no change required | ||
Platform | OS | OS Version | |||
Product Version | CMake-2-8 | ||||
Target Version | Fixed in Version | CMake 2.8.4 | |||
Summary | 0011043: CMake cannot build out-of-source projects with GLOB_RECURSE in CMakeLists.txt | ||||
Description | Minimal configuration to reproduce: root/CMakeLists.txt root/src/main.cpp -- well-known 'Hellow, world' program for example root/build/ -- an empty dir to build in CMakeLists.txt contents: project(main CXX) cmake_minimum_required(VERSION 2.8) file(GLOB_RECURSE SRC src *.cpp) add_executable(main ${SRC}) The issued command: cmake .. && make produce an output: -- The CXX compiler identification is GNU -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Configuring done -- Generating done -- Build files have been written to: /home/om/0/test/build Scanning dependencies of target main [ 50%] Building CXX object CMakeFiles/main.dir/src/main.cpp.o [100%] Building CXX object CMakeFiles/main.dir/CMakeFiles/CompilerIdCXX/CMakeCXXCompilerId.cpp.o /home/om/0/test/build/CMakeFiles/CompilerIdCXX/CMakeCXXCompilerId.cpp:76: warning: deprecated conversion from string constant to ‘char*’ /home/om/0/test/build/CMakeFiles/CompilerIdCXX/CMakeCXXCompilerId.cpp:189: warning: deprecated conversion from string constant to ‘char*’ /home/om/0/test/build/CMakeFiles/CompilerIdCXX/CMakeCXXCompilerId.cpp:190: warning: deprecated conversion from string constant to ‘char*’ Linking CXX executable main CMakeFiles/main.dir/CMakeFiles/CompilerIdCXX/CMakeCXXCompilerId.cpp.o: In function `main': CMakeCXXCompilerId.cpp:(.text+0x0): multiple definition of `main' CMakeFiles/main.dir/src/main.cpp.o:main.cpp:(.text+0x0): first defined here collect2: ld returned 1 exit status make[2]: *** [main] Error 1 make[1]: *** [CMakeFiles/main.dir/all] Error 2 make: *** [all] Error 2 The reason of failure is quite obvious: CMake link it's target with it's internal temporary executable. At CMakeFiles/main.dir/build.make there is this code: # Object files for target main main_OBJECTS = \ "CMakeFiles/main.dir/src/main.cpp.o" \ "CMakeFiles/main.dir/CMakeFiles/CompilerIdCXX/CMakeCXXCompilerId.cpp.o" # External object files for target main main_EXTERNAL_OBJECTS = main: CMakeFiles/main.dir/src/main.cpp.o main: CMakeFiles/main.dir/CMakeFiles/CompilerIdCXX/CMakeCXXCompilerId.cpp.o main: CMakeFiles/main.dir/build.make main: CMakeFiles/main.dir/link.txt @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --red --bold "Linking CXX executable main" $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/main.dir/link.txt --verbose=$(VERBOSE) link.txt have those line: /usr/bin/c++ CMakeFiles/main.dir/src/main.cpp.o CMakeFiles/main.dir/CMakeFiles/CompilerIdCXX/CMakeCXXCompilerId.cpp.o -o main -rdynamic I dunno at what point those files are generated and is there any way to prevent this bad rules to be generated, but it's enough to fix this two points to get things worked. P.S. Yeah-yeah-yeah, I know "You should list all of your 9k source files by hand at CMakeLists.txt" and "You use GLOB? Dieeee!!11" | ||||
Steps To Reproduce | |||||
Additional Information | |||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | |||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2010-07-27 08:06 | ovm | New Issue | |||
2010-07-27 10:27 | ovm | Note Added: 0021492 | |||
2010-07-27 10:44 | ovm | Note Edited: 0021492 | |||
2010-12-15 11:07 | David Cole | Assigned To | => David Cole | ||
2010-12-15 11:07 | David Cole | Status | new => assigned | ||
2010-12-15 11:10 | David Cole | Note Added: 0024158 | |||
2010-12-15 11:10 | David Cole | Status | assigned => resolved | ||
2010-12-15 11:10 | David Cole | Fixed in Version | => CMake 2.8.4 | ||
2010-12-15 11:10 | David Cole | Resolution | open => no change required | ||
2011-04-04 12:00 | David Cole | Note Added: 0026064 | |||
2011-04-04 12:00 | David Cole | Status | resolved => closed |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|