I have some C++ source code that, for a valid reason, does not end in ".cpp" or ".cc" or any other usual C++ extension. I would like to compile this into an executable with CMake.
My very simple CMake script currently is:
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(test)
SET_SOURCE_FILES_PROPERTIES(test_mycode.foo PROPERTIES LANGUAGE CXX)
ADD_EXECUTABLE(test test_mycode.foo)
As far as I understand, SET_SOURCE_FILES_PROPERTIES(...) should be all that is needed to make Cmake recognize "test_mycode.foo" as a C++ file. However, when I try to compile, it fails with the following error:
/usr/bin/c++ -o CMakeFiles/test.dir/test_mycode.foo.o -c test/test_mycode.foo
c++: test/test_mycode.foo: linker input file unused because linking not done
What am I doing wrong here?
Thanks!