Notes |
|
(0032209)
|
Sylwester Arabas
|
2013-02-07 09:11
|
|
Apparently, this would be more correct?:
if(OPENMP_FOUND)
get_target_property(flags ... LINK_FLAGS)
set_target_properties(... PROPERTIES LINK_FLAGS "${flags} ${OpenMP_CXX_FLAGS}")
get_target_property(flags ... COMPILE_FLAGS)
set_target_properties(... PROPERTIES COMPILE_FLAGS "${flags} ${OpenMP_CXX_FLAGS}")
endif() |
|
|
(0032210)
|
Sylwester Arabas
|
2013-02-07 09:19
|
|
And this would be even more correct probably (please confirm):
if(OPENMP_FOUND)
get_target_property(flags ... LINK_FLAGS)
if (${flags} STREQUAL "flags-NOTFOUND")
set(flags "")
endif()
set_target_properties(... PROPERTIES LINK_FLAGS "${flags} ${OpenMP_CXX_FLAGS}")
get_target_property(flags ... COMPILE_FLAGS)
if (${flags} STREQUAL "flags-NOTFOUND")
set(flags "")
endif()
set_target_properties(... PROPERTIES COMPILE_FLAGS "${flags} ${OpenMP_CXX_FLAGS}")
endif()
BTW, get_target_property() docs say that "If the property is not found, VAR will be set to "NOTFOUND".". Apparently the value is then "varname-NOTFOUND"? |
|
|
(0032213)
|
Rolf Eike Beer
|
2013-02-07 14:56
|
|
I would change that sentence to:
"If the compiler supports OpenMP, the flags required to compile with OpenMP support are returned in variables for the different languages. The variables may be empty if the compiler does not need a special flag to support OpenMP."
I would not document there how to set these flags, this does belong in the common documentation and is nothing special to this module. |
|
|
(0032215)
|
Sylwester Arabas
|
2013-02-07 16:06
|
|
Perhaps it's then worth mentioning at least that it's not only the compiler but also the linker that might need these flags. In case of GCC -fopenmp is needed at both stages as otherwise either _OPENMP is not defined or the libgomp library is not linked.
BTW, what about OpenMP_Fortran_FLAGS?
HTH,
Sylwester |
|
|
(0032216)
|
Rolf Eike Beer
|
2013-02-07 16:19
|
|
If you add it to CMAKE_*_FLAGS* it will added to the linker flags automatically.
And once you come up with a test compile file for Fortran it will get added. |
|
|
(0032265)
|
Rolf Eike Beer
|
2013-02-13 13:39
|
|
|
|
(0033422)
|
Robert Maynard
|
2013-07-01 09:37
|
|
Closing resolved issues that have not been updated in more than 4 months. |
|