Skip to content

Commit

Permalink
improve LCI cmake config file
Browse files Browse the repository at this point in the history
  • Loading branch information
JiakunYan committed Jan 8, 2024
1 parent b72f1e3 commit b8a93be
Showing 1 changed file with 38 additions and 35 deletions.
73 changes: 38 additions & 35 deletions LCIConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -1,47 +1,50 @@
@PACKAGE_INIT@
if (NOT TARGET LCI::LCT)

LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/LCI")
include(CMakeFindDependencyMacro)
@PACKAGE_INIT@

set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_dependency(Threads)
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/LCI")
include(CMakeFindDependencyMacro)

set_and_check(LCT_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
set_and_check(LCT_SHARED_LIBRARY "@PACKAGE_CMAKE_INSTALL_LIBDIR@/@CMAKE_SHARED_LIBRARY_PREFIX@lct@CMAKE_SHARED_LIBRARY_SUFFIX@")
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_dependency(Threads)

add_library(LCI::LCT SHARED IMPORTED)
set_target_properties(LCI::LCT PROPERTIES
IMPORTED_LOCATION ${LCT_SHARED_LIBRARY}
)
target_include_directories(LCI::LCT INTERFACE ${LCT_INCLUDE_DIRS})
target_link_libraries(LCI::LCT INTERFACE Threads::Threads)
set_and_check(LCT_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
set_and_check(LCT_SHARED_LIBRARY "@PACKAGE_CMAKE_INSTALL_LIBDIR@/@CMAKE_SHARED_LIBRARY_PREFIX@lct@CMAKE_SHARED_LIBRARY_SUFFIX@")

check_required_components(LCT)
add_library(LCI::LCT SHARED IMPORTED)
set_target_properties(LCI::LCT PROPERTIES
IMPORTED_LOCATION ${LCT_SHARED_LIBRARY}
)
target_include_directories(LCI::LCT INTERFACE ${LCT_INCLUDE_DIRS})
target_link_libraries(LCI::LCT INTERFACE Threads::Threads)

set(LCI_WITH_LCT_ONLY @LCI_WITH_LCT_ONLY@)
if (NOT LCI_WITH_LCT_ONLY)
find_dependency(@FABRIC@)
check_required_components(LCT)

set_and_check(LCI_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
set_and_check(LCI_SHARED_LIBRARY "@PACKAGE_CMAKE_INSTALL_LIBDIR@/@CMAKE_SHARED_LIBRARY_PREFIX@lci@CMAKE_SHARED_LIBRARY_SUFFIX@")
# set_and_check(LCI_STATIC_LIBRARY "@PACKAGE_CMAKE_INSTALL_LIBDIR@/@CMAKE_STATIC_LIBRARY_PREFIX@lci@CMAKE_STATIC_LIBRARY_SUFFIX@")
set(LCI_WITH_LCT_ONLY @LCI_WITH_LCT_ONLY@)
if (NOT LCI_WITH_LCT_ONLY)
find_dependency(@FABRIC@)

add_library(LCI::Shared SHARED IMPORTED)
set_target_properties(LCI::Shared PROPERTIES
IMPORTED_LOCATION ${LCI_SHARED_LIBRARY}
)
target_include_directories(LCI::Shared INTERFACE ${LCI_INCLUDE_DIRS})
target_link_libraries(LCI::Shared INTERFACE Threads::Threads @FABRIC@::@FABRIC@ LCI::LCT)
set_and_check(LCI_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
set_and_check(LCI_SHARED_LIBRARY "@PACKAGE_CMAKE_INSTALL_LIBDIR@/@CMAKE_SHARED_LIBRARY_PREFIX@lci@CMAKE_SHARED_LIBRARY_SUFFIX@")
# set_and_check(LCI_STATIC_LIBRARY "@PACKAGE_CMAKE_INSTALL_LIBDIR@/@CMAKE_STATIC_LIBRARY_PREFIX@lci@CMAKE_STATIC_LIBRARY_SUFFIX@")

add_library(LCI::Shared SHARED IMPORTED)
set_target_properties(LCI::Shared PROPERTIES
IMPORTED_LOCATION ${LCI_SHARED_LIBRARY}
)
target_include_directories(LCI::Shared INTERFACE ${LCI_INCLUDE_DIRS})
target_link_libraries(LCI::Shared INTERFACE Threads::Threads @FABRIC@::@FABRIC@ LCI::LCT)

add_library(LCI::LCI ALIAS LCI::Shared)
add_library(LCI::LCI ALIAS LCI::Shared)

# add_library(LCI::Static STATIC IMPORTED)
# set_target_properties(LCI::Static PROPERTIES
# IMPORTED_LOCATION ${LCI_STATIC_LIBRARY}
# )
# target_include_directories(LCI::Static INTERFACE ${LCI_INCLUDE_DIRS})
# target_link_libraries(LCI::Static INTERFACE Threads::Threads @FABRIC@::@FABRIC@)
# add_library(LCI::Static STATIC IMPORTED)
# set_target_properties(LCI::Static PROPERTIES
# IMPORTED_LOCATION ${LCI_STATIC_LIBRARY}
# )
# target_include_directories(LCI::Static INTERFACE ${LCI_INCLUDE_DIRS})
# target_link_libraries(LCI::Static INTERFACE Threads::Threads @FABRIC@::@FABRIC@)

check_required_components(LCI)
check_required_components(LCI)
endif()
endif()

0 comments on commit b8a93be

Please sign in to comment.