Skip to content

Commit

Permalink
Update CMakeLists.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
johannesschrimpf committed May 31, 2024
1 parent 8aac7b8 commit 3597fbc
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@ message(STATUS "FMT_LIBRARIES = ${FMT_LIBRARIES}")

find_package(spdlog REQUIRED)
set(SPDLOG_LIB spdlog::spdlog)

if("${SPDLOG_LIBRARIES}" STREQUAL "")
set(SPDLOG_LIBRARIES spdlog::spdlog)
set(SPDLOG_LIBRARIES spdlog::spdlog)
endif()

find_package(eventpp CONFIG REQUIRED)
find_package(magic_enum CONFIG REQUIRED)

if("${magic_enum_LIBRARIES}" STREQUAL "")
set(magic_enum_LIBRARIES magic_enum::magic_enum)
set(magic_enum_LIBRARIES magic_enum::magic_enum)
endif()


add_definitions(-DSPDLOG_COMPILED_LIB)
add_definitions(-DSPDLOG_FMT_EXTERNAL=1)

Expand Down Expand Up @@ -68,33 +69,34 @@ target_link_libraries(oculus_driver PUBLIC ${EXT_LIBS})
target_compile_features(oculus_driver PUBLIC cxx_std_17)
target_compile_definitions(oculus_driver PUBLIC MAGIC_ENUM_RANGE_MAX=1024)

#############
## Install ##
#############
# ############
# # Install ##
# ############
include(GNUInstallDirs)

install(DIRECTORY include/oculus_driver
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

install(TARGETS ${PROJECT_NAME}
DESTINATION ${CMAKE_INSTALL_LIBDIR}
EXPORT ${PROJECT_NAME}Targets)
DESTINATION ${CMAKE_INSTALL_LIBDIR}
EXPORT ${PROJECT_NAME}Targets)

# install the exported targets
install(EXPORT ${PROJECT_NAME}Targets
FILE ${PROJECT_NAME}Targets.cmake

# NAMESPACE ${PROJECT_NAME}:: # namespacing does not play well with fetch content
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)

############
## Config ##
############
# ###########
# # Config ##
# ###########
include(CMakePackageConfigHelpers)
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
PATH_VARS INCLUDE_INSTALL_DIR LIB_INSTALL_DIR
PATH_VARS PACKAGE_INCLUDE_INSTALL_DIR PACKAGE_LIB_INSTALL_DIR
)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
Expand All @@ -107,6 +109,7 @@ install(FILES
DESTINATION lib/cmake/${PROJECT_NAME}
)
export(EXPORT ${PROJECT_NAME}Targets

# NAMESPACE ${PROJECT_NAME}:: # namespacing does not play well with fetch content
FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake"
)
Expand Down

0 comments on commit 3597fbc

Please sign in to comment.