MantisBT - CMake
View Issue Details
0015688CMakeCMakepublic2015-08-07 09:562016-06-10 14:31
bburgerm 
Kitware Robot 
normalmajoralways
closedmoved 
CMake 3.3 
 
0015688: ADD_CUSTOM_TARGET with Fortran sources creates invalid Unix Makefiles
The add_custom_target allows to specify "sources" for IDE display but if any Fortran source is specified (and Fortran enabled) make fails with

make[2]: *** No rule to make target 'CMakeFiles/copy.dir/requires'. Stop.

The Visual studio generator creates a *.vfproj project in this case where custom commands only work partially (with Intel Fortran Compiler) - instead of a *.vcxproj when no sources are specified.

-> I would expect the build of a custom target to behave identical with or without sources specified.
Run cmake to create Unix Makefiles for attached CMakeLists.txt, run make -> shows specified error
Stripped down from a huge project with many targets and a common pre-processing script to combine the fortran inputs for automatic interface check (not just copy like in the example). Works if the "sources" argument is removed from the ADD_CUSTOM_TARGET but for better support by IDEs we like to add this argument.

Adding
  SET_SOURCE_FILES_PROPERTIES(s1.f PROPERTIES LANGUAGE "")
Enables to run the custom command, but the compile does nothing then.

Adding
  SET(CMAKE_Fortran_SOURCE_FILE_EXTENSIONS "FFF")
  SET(CMAKE_Fortran_IGNORE_EXTENSIONS "f")
has no effect at all (and would only help too if it can be reset for and add_executable/add_library)

Identical behaviour of CMake-3.0.2 and CMake-3.3.
No tags attached.
txt CMakeLists.txt (385) 2015-08-07 09:56
https://public.kitware.com/Bug/file/5505/CMakeLists.txt
Issue History
2015-08-07 09:56bburgermNew Issue
2015-08-07 09:56bburgermFile Added: CMakeLists.txt
2015-08-10 11:01Brad KingNote Added: 0039261
2016-06-10 14:29Kitware RobotNote Added: 0042819
2016-06-10 14:29Kitware RobotStatusnew => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0039261)
Brad King   
2015-08-10 11:01   
Several generators have various special cases when Fortran sources appear in a target. It looks like those need to be made conditional to not apply on custom targets.
(0042819)
Kitware Robot   
2016-06-10 14:29   
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.