Skip to content
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

Use FetchContent for the dependencies #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions cmake/costaConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ set(COSTA_SCALAPACK "@COSTA_SCALAPACK@")
find_dependency(MPI)
find_dependency(OpenMP)

set(COSTA_SCALAPACK "@COSTA_SCALAPACK@")

if (NOT COSTA_SCALAPACK STREQUAL "OFF")
find_dependency(SCALAPACK)
endif ()
Expand Down
17 changes: 14 additions & 3 deletions src/costa/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,15 @@ endif()

list(APPEND INSTALLED_TARGETS_LIST "costa")

if(NOT COSTA_SCALAPACK STREQUAL "OFF")
message("COSTA_SCALAPACK : ${COSTA_SCALAPACK}")

if(NOT COSTA_SCALAPACK STREQUAL "OFF")
add_library(costa_scalapack ${costa_scalapack_src_files})
add_library(costa_prefixed_scalapack ${costa_prefixed_scalapack_src_files})

# alias targets for add_subdirectory dependency
add_library(costa::costa_scalapack ALIAS costa_scalapack)
add_library(costa::costa_prefixed_scalapack ALIAS costa_prefixed_scalapack)
# add_library(costa::costa_scalapack ALIAS costa_scalapack)
# add_library(costa::costa_prefixed_scalapack ALIAS costa_prefixed_scalapack)

set_property(TARGET costa_prefixed_scalapack PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET costa_scalapack PROPERTY POSITION_INDEPENDENT_CODE ON)
Expand Down Expand Up @@ -113,3 +114,13 @@ install(EXPORT costa_targets
FILE costaTargets.cmake
NAMESPACE costa::
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/costa")

# FetchContent does use the config.cmake files at all, so we have
# to define the costa::* targets if costa is build at the same time
# than the main project.

foreach(_target costa_scalapack costa_prefixed_scalapack costa)
if (TARGET ${_target} AND NOT TARGET "costa::${_target}")
add_library(costa::${_target} ALIAS ${_target})
endif()
endforeach()