MantisBT - CMake
View Issue Details
0009908CMakeCMakepublic2009-11-17 06:472015-07-08 08:57
Henning Laursen 
Bill Hoffman 
normalminoralways
closedduplicate 
CMake-2-6 
 
0009908: *.Cxx files in the windows version
I not sure it's an bug but here it comes:


When adding files to libraries or exec in CMakeLists.txt files I used the extension .cxx on the files. As the example project http://www.cmake.org/cmake/help/examples.html [^] explains, but that keeps yielding an error upon generation:

CMake Error in Demo/CMakeLists.txt:
  Cannot find source file "demo.cxx". Tried extensions .c .C .c++ .cc .cpp
  .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx

But when I changed the file extension in the CMakeLists.txt to .cpp it works, but the error states that CMake have tryed with all the mentioned extension, which doesn't seem to be the case. I haven't tried 2.8 yet, the observation is made with CMake 2.6-patch4.
I'm happy my project is working, but this might help other newbies to CMake :)
No tags attached.
duplicate of 0013190closed Kitware Robot Add CMake Policy to drop automatic source extension search 
zip CMakeTest.zip (28,602) 2009-11-17 09:41
https://public.kitware.com/Bug/file/2659/CMakeTest.zip
Issue History
2009-11-17 06:47Henning LaursenNew Issue
2009-11-17 08:24Bill HoffmanStatusnew => assigned
2009-11-17 08:24Bill HoffmanAssigned To => Bill Hoffman
2009-11-17 08:26Bill HoffmanNote Added: 0018462
2009-11-17 09:41Henning LaursenFile Added: CMakeTest.zip
2009-11-17 09:42Henning LaursenNote Added: 0018463
2009-11-17 10:06Bill HoffmanNote Added: 0018464
2009-11-18 01:53Henning LaursenNote Added: 0018469
2009-11-18 09:37Bill HoffmanNote Added: 0018473
2015-02-26 15:18Stephen KellyRelationship addedduplicate of 0013190
2015-02-26 15:18Stephen KellyStatusassigned => resolved
2015-02-26 15:18Stephen KellyResolutionopen => duplicate
2015-07-08 08:57Robert MaynardNote Added: 0039073
2015-07-08 08:57Robert MaynardStatusresolved => closed

Notes
(0018462)
Bill Hoffman   
2009-11-17 08:26   
.cxx files should work just fine. That error means demo.cxx was not found by CMake. If you could give a complete example (tar or zip) that shows the problem we can figure out what is going wrong.
(0018463)
Henning Laursen   
2009-11-17 09:42   
Hi

I've uploaded my project, it contains a readme.txt with version and etc. details.
(0018464)
Bill Hoffman   
2009-11-17 10:06   
Uhh....

ls
CMakeLists.txt hello.cpp hello.h

# Create a library called "Hello" which includes the source file "hello.cxx".
add_library (HelloLib hello.cxx)


You have to actually rename the file on disk to .cxx instead of .cpp for this to work....
(0018469)
Henning Laursen   
2009-11-18 01:53   
thanks, but how come the error response tell me that it tried all the listed extension?

Tried extensions .c .C .c++ .cc .cpp
  .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx

It should have found the .cpp files, if it tried adding the extension or should the CMakeLists.txt just state:

# Create a library called "Hello" which includes the source file "hello.cxx".
add_library (HelloLib hello)

I don't know the insides of CMAKE, but is it trying hello.cxx.XXX instead of hello.XXX, where XXX denotes all the extensions in the error message or how does CMAKE handle this?
(0018473)
Bill Hoffman   
2009-11-18 09:37   
What it tried was hello.cxx.cpp, if you did add_library(HelloLib hello) then it would work. However, we are considering deprecating this type of thing anyway.
(0039073)
Robert Maynard   
2015-07-08 08:57   
Closing resolved issues that have not been updated in more than 4 months.