Skip to content

Commit

Permalink
bug cmake: fix build breaking on second cmake configure run
Browse files Browse the repository at this point in the history
7799dbc9676edf2bc963069a0f65ee159ee01dd1
  • Loading branch information
Anton3 committed May 26, 2024
1 parent c53e30e commit 6587c93
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 7 additions & 0 deletions samples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ project(userver-samples CXX)

add_custom_target(${PROJECT_NAME})

# Imitate an installed userver in samples.
file(WRITE "${CMAKE_BINARY_DIR}/package_stubs/userverConfig.cmake")

add_subdirectory(config_service)
add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}-config_service)

Expand Down Expand Up @@ -95,3 +98,7 @@ if (USERVER_FEATURE_YDB AND USERVER_FEATURE_MONGODB)
add_subdirectory(ydb_service)
add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}-ydb_service)
endif()

# Clean up fake userver installation above to avoid messing
# with find_package(userver) in the parent project.
file(REMOVE "${CMAKE_BINARY_DIR}/package_stubs/userverConfig.cmake")
4 changes: 0 additions & 4 deletions universal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,6 @@ write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/userverConfigVersion.cmake
VERSION ${USERVER_VERSION} COMPATIBILITY SameMajorVersion
)

if (NOT USERVER_INSTALL)
set(userver_DIR "${CMAKE_CURRENT_BINARY_DIR}/" CACHE INTERNAL "")
endif()

_userver_directory_install(COMPONENT universal FILES
"${CMAKE_CURRENT_BINARY_DIR}/userverConfig.cmake"
Expand Down

0 comments on commit 6587c93

Please sign in to comment.