Skip to content

Commit

Permalink
cmake: check if subdir CMakeLists exist
Browse files Browse the repository at this point in the history
  • Loading branch information
mgates3 committed Oct 26, 2020
1 parent 76c737d commit e7c6484
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
16 changes: 13 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -323,14 +323,18 @@ if (NOT TARGET blaspp)
find_package( blaspp QUIET )
if (blaspp_FOUND)
message( " Found BLAS++: ${blaspp_DIR}" )
else()
elseif (EXISTS "${CMAKE_SOURCE_DIR}/blaspp/CMakeLists.txt")
set( build_tests_save "${build_tests}" )
set( build_tests "false" )

add_subdirectory( "blaspp" )

set( build_tests "${build_tests_save}" )
set( blaspp_DIR "${CMAKE_BINARY_DIR}/blaspp" )
else()
message( FATAL_ERROR "blaspp/CMakeLists.txt doesn't exist. Use:\n"
" git submodule update --init\n"
"to checkout submodules." )
endif()
else()
message( " BLAS++ already included" )
Expand All @@ -344,14 +348,20 @@ if (NOT TARGET lapackpp)
find_package( lapackpp QUIET )
if (lapackpp_FOUND)
message( " Found LAPACK++: ${lapackpp_DIR}" )
else()

elseif (EXISTS "${CMAKE_SOURCE_DIR}/lapackpp/CMakeLists.txt")
set( build_tests_save "${build_tests}" )
set( build_tests "false" )

add_subdirectory( "lapackpp" )

set( build_tests "${build_tests_save}" )
set( blaspp_DIR "${CMAKE_BINARY_DIR}/blaspp" )
set( lapackpp_DIR "${CMAKE_BINARY_DIR}/lapackpp" )

else()
message( FATAL_ERROR "lapackpp/CMakeLists.txt doesn't exist. Use:\n"
" git submodule update --init\n"
"to checkout submodules." )
endif()
else()
message( " LAPACK++ already included" )
Expand Down
12 changes: 11 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,21 @@ if (NOT TARGET testsweeper)
find_package( testsweeper QUIET )
if (testsweeper_FOUND)
message( " Found TestSweeper library: ${testsweeper_DIR}" )
else()

elseif (EXISTS "${CMAKE_SOURCE_DIR}/testsweeper/CMakeLists.txt")
add_subdirectory( "${CMAKE_SOURCE_DIR}/testsweeper"
"${CMAKE_BINARY_DIR}/testsweeper" )

else()
set( url "https://bitbucket.org/icl/testsweeper" )
message( "" )
message( "---------- TestSweeper" )
message( STATUS "Fetching TestSweeper from ${url}" )
include( FetchContent )
FetchContent_Declare( testsweeper GIT_REPOSITORY "${url}" )
FetchContent_MakeAvailable( testsweeper )
message( "---------- TestSweeper done" )
message( "" )
endif()
else()
message( " TestSweeper already included" )
Expand Down

0 comments on commit e7c6484

Please sign in to comment.