[CMake] Compile C files with C++

J Decker d3ck0r at gmail.com
Thu Dec 5 13:20:50 EST 2013


Sorry and another soultuion.... when globbing, copy all the c files to
.cxx files and use those instead
then you can have different flags for the different modes also

On Thu, Dec 5, 2013 at 10:19 AM, J Decker <d3ck0r at gmail.com> wrote:
> that works... it's path specific though, are you also using
> ${all_c_files} as the source names?
> if your globbing ends up including the path the base source name won't
> match or vice versa...
>
> On Thu, Dec 5, 2013 at 6:16 AM, Tom Browder <tom.browder at gmail.com> wrote:
>> I found this 2009 thread:
>>
>>   http://marc.info/?l=cmake&m=123851619629929&w=2
>>
>> discussing this issue and I tried all suggestions but still cannot get
>> C files compiled with C++.
>>
>> The last suggestion was to glob all C source files and set a LANGUAGE
>> CXX property on each.  I put this at the very top of my master
>> CMakeLists.txt file:
>>
>>   file(GLOB_RECURSE all_c_files ${CMAKE_SOURCE_DIR}/src/*.c)
>>   set_source_files_properties(${all_c_files} PROPERTIES LANGUAGE CXX)
>>
>> to no avail (I also tried putting double quotes around the glob expression).
>>
>> Ideas?
>>
>> Best regards,
>>
>> -Tom
>> --
>>
>> Powered by www.kitware.com
>>
>> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>>
>> CMake Support: http://cmake.org/cmake/help/support.html
>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list