Closed robertodr closed 7 years ago
Interesting. I did not know there was a difference between declaring a language with project
or enable_language
. I liked that the language was defined in one place and this is now lost but I think your suggestion is better although one could now declare Fortran in the YAML and then include C via the module.
The ternary is a bit terse but I can then expand it and add a comment.
Indeed the enable_language
is now redundant.
Do the broken tests have anything to do with this PR? You mentioned over coffee that this might need more testing or was this something else?
I did not know either. It came as a big surprise that for a Fortran-only project both the C and C++ compiler were searched for before the Fortran compiler. I think this need documenting inside Autocmake, i.e. that the language is set in the YAML file and in a module. If you don't have time writing docs, hold off merging until I can.
By the way, the language
field in the YAML is now compulsory.
The fc_omp
test is broken, as it seems CMake checks for the C OpenMP flag even though the language is not defined. I am puzzled by the fact that the if(DEFINED CMAKE_<LANG>_COMPILER_ID)
checks are in place and should avoid these scenarios...
I cannot reproduce the problem locally. I will check whether this is linked to the CMake version.
Can you please update your branch with latest changes on upstream master? Now testing CMake 3.8.0 instead of an arcane 2.8. Hopefully this will resolve the problem.
Apologies for slow response. Fortran tests cases are failing Mac OS X.
No problem - if somebody is slow then it's me. Just for my reference saving your good suggestion: "Try using a layer xcode image 7.3".
And it worked! I think you can ignore the older XCode version on Travis. I will rebase and squash some of the commits so you get a cleaner history.
Awesome! Thank you so much for this important change and also for your patience with this.
Parse language field in YAML to generate
project(<PROJECT_NAME <PROJECT_LANGUAGE>)
inCMakeLists.txt
Why? Delayed enabling of languages within the
cc.cmake
,cxx.cmake
andfc.cmake
causes CMake to load C and C++ as default languages for a project. This is in principle unnecessary for a project that only needs one language. The "only one language" behavior can be enforced by setting the language when declaring the project.Questions
[x] This line uses a ternary if to check whether a list of languages or a single language was given. It might not be exactly the most readable piece of code.
[x] The
enable_language
incc.cmake
,cxx.cmake
andfc.cmake
is probably redundant.[x] Ready to go