Skip to content

Commit 06db4d8

Browse files
authored
CMake: Move target inclusion after dependency discovery (grimme-lab#127)
Including CMake target file before dependency discovery will cause CMake failure such as: ``` CMake Error at /opt/test/cp2k-spack/spack/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__sp/linux-skylake/mctc-lib-0.4.2-yf4ytpd2bs4tp5yv7p5tdz5ymxiw5ra5/lib64/cmake/mctc-lib/mctc-lib-targets.cmake:68 (set_target_properties): The link interface of target "mctc-lib::mctc-lib-lib" contains: OpenMP::OpenMP_Fortran but the target was not found. Possible reasons include: ```
1 parent 061056a commit 06db4d8

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

config/template-config.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ set(MCTCLIB_USE_TOMLF @MCTCLIB_USE_TOMLF@)
88
enable_language("Fortran")
99

1010
if(NOT TARGET "@PROJECT_NAME@::@PROJECT_NAME@")
11-
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake")
1211
include(CMakeFindDependencyMacro)
1312

1413
if(NOT TARGET "OpenMP::OpenMP_Fortran" AND MCTCLIB_WITH_OpenMP)
@@ -22,4 +21,6 @@ if(NOT TARGET "@PROJECT_NAME@::@PROJECT_NAME@")
2221
if(NOT TARGET "jonquil::jonquil" AND MCTCLIB_USE_JONQUIL)
2322
find_dependency("jonquil")
2423
endif()
24+
25+
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake")
2526
endif()

0 commit comments

Comments
 (0)