Skip to content

Commit

Permalink
remove Full library
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizux committed Oct 16, 2024
1 parent ed8ed3b commit a7f11e6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 40 deletions.
2 changes: 1 addition & 1 deletion FooBar/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ elseif(UNIX)
POSITION_INDEPENDENT_CODE ON
INSTALL_RPATH "$ORIGIN")
endif()
target_link_libraries(FooBar PRIVATE absl::log Bar Foo)
target_link_libraries(FooBar PUBLIC absl::log Bar Foo)
add_library(${PROJECT_NAMESPACE}::FooBar ALIAS FooBar)

add_subdirectory(tests)
Expand Down
2 changes: 1 addition & 1 deletion FooBarApp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ target_link_libraries(FooBarApp PRIVATE
absl::log_severity
absl::strings
protobuf::libprotobuf
CMakeCpp::Full
CMakeCpp::FooBar
)

add_executable(${PROJECT_NAMESPACE}::FooBarApp ALIAS FooBarApp)
Expand Down
2 changes: 1 addition & 1 deletion ci/samples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set_target_properties(sample PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
VERSION ${PROJECT_VERSION})
target_link_libraries(sample PRIVATE CMakeCpp::Full)
target_link_libraries(sample PRIVATE CMakeCpp::FooBar)

if(BUILD_TESTING)
add_test(NAME sample_UT COMMAND sample)
Expand Down
38 changes: 1 addition & 37 deletions cmake/cpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -70,42 +70,6 @@ add_subdirectory(Foo)
add_subdirectory(Bar)
add_subdirectory(FooBar)

add_library(Full)
# Xcode fails to build if library doesn't contains at least one source file.
if(XCODE)
file(GENERATE
OUTPUT ${PROJECT_BINARY_DIR}/${PROJECT_NAME}/version.cpp
CONTENT "namespace {char* version = \"${PROJECT_VERSION}\";}")
target_sources(Full PRIVATE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}/version.cpp)
endif()
target_sources(Full PRIVATE
$<TARGET_OBJECTS:Bar>
$<TARGET_OBJECTS:Foo>
$<TARGET_OBJECTS:FooBar>
)
target_include_directories(Full
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Foo/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Bar/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/FooBar/include>
$<INSTALL_INTERFACE:include>)
target_compile_features(Full PUBLIC cxx_std_20)
set_target_properties(Full PROPERTIES VERSION ${PROJECT_VERSION})
if(APPLE)
set_target_properties(Full PROPERTIES INSTALL_RPATH "@loader_path")
elseif(UNIX)
set_target_properties(Full PROPERTIES INSTALL_RPATH "$ORIGIN")
endif()
target_link_libraries(Full PRIVATE absl::log)
add_library(${PROJECT_NAMESPACE}::Full ALIAS Full)
install(TARGETS Full
EXPORT ${PROJECT_NAME}Targets
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/foobar
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
#RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

add_subdirectory(FooBarApp)

# Install
Expand Down Expand Up @@ -152,7 +116,7 @@ function(add_cpp_example FILE_NAME)
target_include_directories(${EXAMPLE_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_compile_features(${EXAMPLE_NAME} PRIVATE cxx_std_20)
target_link_libraries(${EXAMPLE_NAME} PRIVATE
${PROJECT_NAMESPACE}::Full
${PROJECT_NAMESPACE}::FooBar
)

include(GNUInstallDirs)
Expand Down

0 comments on commit a7f11e6

Please sign in to comment.