View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0008851 | CMake | CMake | public | 2009-04-06 10:59 | 2016-06-10 14:30 | ||||
Reporter | Alexandre Feblot | ||||||||
Assigned To | Bill Hoffman | ||||||||
Priority | normal | Severity | minor | Reproducibility | have not tried | ||||
Status | closed | Resolution | moved | ||||||
Platform | OS | OS Version | |||||||
Product Version | |||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0008851: Allow to globally set which compiler to use with a given file extension | ||||||||
Description | CMAKE_CXX_SOURCE_FILE_EXTENSIONS and CMAKE_C_SOURCE_FILE_EXTENSIONS are currently read-only variables, as they are: - overwritten by project() or enable_language() if they are set before calling these functions. - not taken into account anymore after calling these functions. So the current and ugly way to let cmake know that you want, let's say all .c files considered as C++ is to set the LANGUAGE property for all of them. Modifications to CMAKE_CXX_SOURCE_FILE_EXTENSIONS and CMAKE_C_SOURCE_FILE_EXTENSIONS values should be honored after calling project() or enable_language(). Typical use case: project(MY_PROJECT C CXX) # also add "C" because a specific lib might need to be compiled in pure C. list(APPEND CMAKE_CXX_SOURCE_FILE_EXTENSIONS "c") list(REMOVE_ITEM CMAKE_C_SOURCE_FILE_EXTENSIONS "c") add_subdirectory(...) | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | |
Relationships |
Notes | |
(0038873) FlorianM (reporter) 2015-06-02 07:04 edited on: 2015-06-02 07:15 |
I also would have needed this before and like to propose a quite simple solution for this: If CMAKE_<LANG>_SOURCE_FILE_EXTENSIONS and CMAKE_<LANG>_IGNORE_EXTENSIONS would be defined as cached variables (without FORCE) I could change/pre-define its value as I could do with CMAKE_<LANG>_FLAGS (including the possibility to set it in a toolchain file). E.g. changing CMakeCXXCompiler.cmake.in to: ... set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC CACHE INTERNAL "") set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;mm;CPP CACHE INTERNAL "") ... That would still need to be defined before the project()/enable_language() commands, but at least I could change the values. Possible workaround with current versions: using one of the "hooks"/configuration variables inside e.g. CMakeCXXCompiler.cmake.in: cmake_minimum_required(VERSION 2.8) set(CMAKE_CXX_SYSROOT_FLAG_CODE "list(APPEND CMAKE_CXX_SOURCE_FILE_EXTENSIONS xyz)") project(Test CXX) add_executable(Test SomeOtherFile.xyz) |
(0041538) Kitware Robot (administrator) 2016-06-10 14:27 |
Resolving issue as `moved`. This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2009-04-06 10:59 | Alexandre Feblot | New Issue | |
2009-04-06 11:03 | Bill Hoffman | Status | new => assigned |
2009-04-06 11:03 | Bill Hoffman | Assigned To | => Bill Hoffman |
2015-06-02 07:04 | FlorianM | Note Added: 0038873 | |
2015-06-02 07:07 | FlorianM | Note Edited: 0038873 | |
2015-06-02 07:08 | FlorianM | Note Edited: 0038873 | |
2015-06-02 07:15 | FlorianM | Note Edited: 0038873 | |
2016-06-10 14:27 | Kitware Robot | Note Added: 0041538 | |
2016-06-10 14:27 | Kitware Robot | Status | assigned => resolved |
2016-06-10 14:27 | Kitware Robot | Resolution | open => moved |
2016-06-10 14:30 | Kitware Robot | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |