Skip to content

CMakeにおいてOpenMP::OpenMP_CXXを用いる。 #619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
t-sakashita opened this issue Nov 29, 2024 · 0 comments
Open

CMakeにおいてOpenMP::OpenMP_CXXを用いる。 #619

t-sakashita opened this issue Nov 29, 2024 · 0 comments
Assignees

Comments

@t-sakashita
Copy link
Owner

t-sakashita commented Nov 29, 2024

修正前:

# OpenMP
set(ROKKO_HAVE_OPENMP False)
if(NOT DISABLE_OPENMP)
  find_package(OpenMP)
  if(OPENMP_FOUND)
    set(ROKKO_HAVE_OPENMP True)
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
    # Almost always OpenMP flags are same both for C and for Fortran.
    set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${OpenMP_Fortran_FLAGS}")
  endif(OPENMP_FOUND)
endif(NOT DISABLE_OPENMP)

修正案:上記のset文を削除して、実行ファイルごとに以下を書くべき?

  if(OpenMP_CXX_FOUND)
    target_link_libraries(${name} PUBLIC OpenMP::OpenMP_CXX)
  endif()

rokkoのライブラリファイルにだけOpenMP::OpenMP_CXXを指定するのは、有効ではない気がする。(インクルードファイルも含むため。)

@t-sakashita t-sakashita self-assigned this Nov 29, 2024
@t-sakashita t-sakashita changed the title OpenMP::OpenMP_CXXを用いる。 CMakeにおいてOpenMP::OpenMP_CXXを用いる。 Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant