Skip to content

Commit

Permalink
simplify cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
Shitaro committed Aug 21, 2024
1 parent 9914dfa commit 9e7da52
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 50 deletions.
46 changes: 3 additions & 43 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,50 +11,10 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Protobuf REQUIRED)

# Create a static library
file(GLOB SRC "ommx/v1/*.pb.cc")
file(GLOB SRC "src/ommx/v1/*.pb.cc")
add_library(ommx STATIC ${SRC})

target_include_directories(ommx PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
target_include_directories(ommx PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>/src
$<INSTALL_INTERFACE:include>
)

target_link_libraries(ommx PUBLIC protobuf::libprotobuf)

install(TARGETS ommx
EXPORT ommxTargets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)

install(DIRECTORY ommx
DESTINATION include
FILES_MATCHING PATTERN "*.h"
)

install(EXPORT ommxTargets
FILE ommxTargets.cmake
NAMESPACE ommx::
DESTINATION lib/cmake/ommx
)

include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"ommxConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion
)

configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/ommxConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/ommxConfig.cmake"
INSTALL_DESTINATION lib/cmake/ommx
)

install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/ommxConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/ommxConfigVersion.cmake"
DESTINATION lib/cmake/ommx
)
7 changes: 0 additions & 7 deletions cpp/cmake/ommxConfig.cmake.in

This file was deleted.

0 comments on commit 9e7da52

Please sign in to comment.