Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix double declaration of protobuf and construction of the binary #66

Merged
merged 1 commit into from
Apr 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions server-core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(PLATFORM_NAME "linux")
endif()

message(STATUS "PLATFORMA_NAME ${PLATFORM_NAME}")
message(STATUS "PLATFORM_NAME ${PLATFORM_NAME}")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix a typo in CMakeLists.txt


find_package(Protobuf CONFIG REQUIRED)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
Expand All @@ -47,16 +47,9 @@ if(UNIX)
endif(UNIX)

find_package(asio CONFIG REQUIRED)
target_link_libraries(server-cmd PRIVATE asio::asio)

find_package(spdlog CONFIG REQUIRED)
target_link_libraries(server-cmd PRIVATE spdlog::spdlog)

find_package(Protobuf CONFIG REQUIRED)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Repeat Find Protobuf

target_link_libraries(server-cmd PRIVATE protobuf::libprotobuf)

find_package(cxxopts CONFIG REQUIRED)
target_link_libraries(server-cmd PRIVATE cxxopts::cxxopts)
target_link_libraries(server-cmd PRIVATE asio::asio spdlog::spdlog protobuf::libprotobuf cxxopts::cxxopts)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

target_link_libraries won't do link many times. It's a kind of declaration. After CMake configure the project, it will generate only one link command. One line or Multiline target_link_libraries have no difference.


if(${PLATFORM_NAME} STREQUAL "linux")
find_package(PkgConfig REQUIRED)
Expand Down