View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0009908CMakeCMakepublic2009-11-17 06:472015-07-08 08:57
ReporterHenning Laursen 
Assigned ToBill Hoffman 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionduplicate 
PlatformOSOS Version
Product VersionCMake-2-6 
Target VersionFixed in Version 
Summary0009908: *.Cxx files in the windows version
DescriptionI 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 :)
TagsNo tags attached.
Attached Fileszip file icon CMakeTest.zip [^] (28,602 bytes) 2009-11-17 09:41

 Relationships
duplicate of 0013190closedKitware Robot Add CMake Policy to drop automatic source extension search 

  Notes
(0018462)
Bill Hoffman (manager)
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 (reporter)
2009-11-17 09:42

Hi

I've uploaded my project, it contains a readme.txt with version and etc. details.
(0018464)
Bill Hoffman (manager)
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 (reporter)
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 (manager)
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 (manager)
2015-07-08 08:57

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2009-11-17 06:47 Henning Laursen New Issue
2009-11-17 08:24 Bill Hoffman Status new => assigned
2009-11-17 08:24 Bill Hoffman Assigned To => Bill Hoffman
2009-11-17 08:26 Bill Hoffman Note Added: 0018462
2009-11-17 09:41 Henning Laursen File Added: CMakeTest.zip
2009-11-17 09:42 Henning Laursen Note Added: 0018463
2009-11-17 10:06 Bill Hoffman Note Added: 0018464
2009-11-18 01:53 Henning Laursen Note Added: 0018469
2009-11-18 09:37 Bill Hoffman Note Added: 0018473
2015-02-26 15:18 Stephen Kelly Relationship added duplicate of 0013190
2015-02-26 15:18 Stephen Kelly Status assigned => resolved
2015-02-26 15:18 Stephen Kelly Resolution open => duplicate
2015-07-08 08:57 Robert Maynard Note Added: 0039073
2015-07-08 08:57 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team