MantisBT - CMake
View Issue Details
0015990CMakeCMakepublic2016-02-26 14:402016-06-10 13:55
abductor 
Brad King 
highmajoralways
closedfixed 
x64Windows7
CMake 3.4.1 
CMake 3.6CMake 3.6 
0015990: CMake multi-processor compilation for Fortran projects
For Fortran project Visual Studio support /MP flags for multi-processor compile.

How set this flag in CMakeLists.txt for Fortran projects?

For example, I set definition /MP for c++ projects. and it is work.

But don't work for Fortran language. I try set in CMAKE_Fortran_FLAGS /MP flag, but unsuccessfully.

http://stackoverflow.com/questions/35636166/cmake-multi-processor-compile-for-fortran-projects [^]
No tags attached.
Issue History
2016-02-26 14:40abductorNew Issue
2016-02-26 15:06Brad KingNote Added: 0040562
2016-02-26 15:11abductorNote Added: 0040563
2016-02-29 11:14abductorNote Added: 0040582
2016-03-28 16:14abductorNote Added: 0040764
2016-03-29 08:47Brad KingNote Added: 0040766
2016-03-29 08:48Brad KingAssigned To => Brad King
2016-03-29 08:48Brad KingStatusnew => resolved
2016-03-29 08:48Brad KingResolutionopen => fixed
2016-03-29 08:48Brad KingFixed in Version => CMake 3.6
2016-03-29 08:48Brad KingTarget Version => CMake 3.6
2016-03-29 08:48Brad KingDescription Updatedbug_revision_view_page.php?rev_id=2066#r2066
2016-06-07 15:40abductorNote Added: 0041150
2016-06-10 13:55Kitware RobotNote Added: 0041154
2016-06-10 13:55Kitware RobotStatusresolved => closed

Notes
(0040562)
Brad King   
2016-02-26 15:06   
Something like this might work (untested):

----------------------------------------------------------------------------
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index ae6a24e..cdc4f68 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -480,6 +480,11 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorFlagTable[] =
   {"ProgramDataBaseFileName", "Fd", "Program Database File Name", "",
    cmVS7FlagTable::UserValue},
 
+ {"MultiProcessorCompilation", "MP", "", "true",
+ cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
+ {"ProcessorNumber", "MP", "Multi-processor Compilation", "",
+ cmVS7FlagTable::UserValueRequired},
+
   // boolean flags
   {"BufferSecurityCheck", "GS", "Buffer security check", "true", 0},
   {"BufferSecurityCheck", "GS-", "Turn off Buffer security check", "false", 0},
----------------------------------------------------------------------------

The names may need to be updated to match what .vfproj files expect.
(0040563)
abductor   
2016-02-26 15:11   
This patch is consist in 3.5.0 ?
(0040582)
abductor   
2016-02-29 11:14   
I add you patch in 3.4.3. don't work.
(0040764)
abductor   
2016-03-28 16:14   
up!
(0040766)
Brad King   
2016-03-29 08:47   
The patch in 0015990:0040562 added the entries to the wrong flag table. I've applied a corrected version of the patch:

 VS: Map Intel Fortran `/MP` flag for multi-processor compilation
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=729f5f01 [^]
(0041150)
abductor   
2016-06-07 15:40   
thanks, it's work.
(0041154)
Kitware Robot   
2016-06-10 13:55   
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.