Skip to content

Commit

Permalink
[cmake] Remove need for CMAKE_FIND_PACKAGE_PREFER_CONFIG (#2009)
Browse files Browse the repository at this point in the history
* Have eCALConfig.cmake prefer protobuf in Config mode
* Remove usage from repo
  • Loading branch information
DownerCase authored Feb 19, 2025
1 parent eb143d3 commit 1381a20
Show file tree
Hide file tree
Showing 81 changed files with 12 additions and 148 deletions.
8 changes: 7 additions & 1 deletion cmake/eCALConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ set(eCAL_VERSION_STRING @eCAL_VERSION_STRING@)
set(CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL Release "")
set(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO Release "")

find_package(Protobuf REQUIRED)
# Try and find protobuf in Config mode first
# (Primarily for Windows where we provide protobuf as part of eCAL)
find_package(Protobuf CONFIG)
if(NOT Protobuf_FOUND)
# Search for Protobuf using Module mode (with no Config mode fallback)
find_package(Protobuf MODULE REQUIRED)
endif()

include("@PACKAGE_eCAL_install_cmake_dir@/helper_functions/ecal_add_functions.cmake")
include("@PACKAGE_eCAL_install_cmake_dir@/helper_functions/ecal_helper_functions.cmake")
Expand Down
3 changes: 1 addition & 2 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,11 @@ def generate(self):
tc.variables["ECAL_THIRDPARTY_BUILD_HDF5"] = "OFF"
tc.variables["ECAL_THIRDPARTY_BUILD_TINYXML2"] = "OFF"
tc.variables["ECAL_BUILD_DOCS"] = "ON"
tc.variables["CMAKE_FIND_PACKAGE_PREFER_CONFIG"] = "ON"
if self.settings.os == "Windows":
tc.variables["Protobuf_PROTOC_EXECUTABLE"] = os.path.join(self.deps_cpp_info["protobuf"].rootpath, "bin", "protoc.exe").replace('\\', '/')
else:
tc.variables["Protobuf_PROTOC_EXECUTABLE"] = os.path.join(self.deps_cpp_info["protobuf"].rootpath, "bin", "protoc")
tc.generate()




3 changes: 1 addition & 2 deletions doc/rst/configuration/src/hello_config/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
cmake_minimum_required(VERSION 3.0)
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(hello_config)

Expand All @@ -16,4 +15,4 @@ add_executable(${PROJECT_NAME} ${source_files})

target_link_libraries(${PROJECT_NAME}
eCAL::core
)
)
3 changes: 1 addition & 2 deletions doc/rst/configuration/src/publisher_config/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
cmake_minimum_required(VERSION 3.0)
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(publisher_config)

Expand All @@ -16,4 +15,4 @@ add_executable(${PROJECT_NAME} ${source_files})

target_link_libraries(${PROJECT_NAME}
eCAL::core
)
)
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
cmake_minimum_required(VERSION 3.0)
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(hello_world_rec)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
cmake_minimum_required(VERSION 3.0)
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(hello_world_snd)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
cmake_minimum_required(VERSION 3.0)
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(protobuf_rec)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
cmake_minimum_required(VERSION 3.0)
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(protobuf_snd)

Expand Down
2 changes: 0 additions & 2 deletions ecal/samples/cpp/benchmarks/counter_rec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

cmake_minimum_required(VERSION 3.10)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(counter_rec)

find_package(eCAL REQUIRED)
Expand Down
2 changes: 0 additions & 2 deletions ecal/samples/cpp/benchmarks/counter_snd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

cmake_minimum_required(VERSION 3.10)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(counter_snd)

find_package(eCAL REQUIRED)
Expand Down
2 changes: 0 additions & 2 deletions ecal/samples/cpp/benchmarks/datarate_rec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

cmake_minimum_required(VERSION 3.10)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(datarate_rec)

find_package(eCAL REQUIRED)
Expand Down
2 changes: 0 additions & 2 deletions ecal/samples/cpp/benchmarks/datarate_snd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

cmake_minimum_required(VERSION 3.10)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(datarate_snd)

find_package(eCAL REQUIRED)
Expand Down
2 changes: 0 additions & 2 deletions ecal/samples/cpp/benchmarks/dynsize_snd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

cmake_minimum_required(VERSION 3.10)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(dynsize_snd)

find_package(eCAL REQUIRED)
Expand Down
2 changes: 0 additions & 2 deletions ecal/samples/cpp/benchmarks/latency_client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

cmake_minimum_required(VERSION 3.10)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(latency_client)

find_package(eCAL REQUIRED)
Expand Down
2 changes: 0 additions & 2 deletions ecal/samples/cpp/benchmarks/latency_rec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

cmake_minimum_required(VERSION 3.10)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(latency_rec)

find_package(eCAL REQUIRED)
Expand Down
2 changes: 0 additions & 2 deletions ecal/samples/cpp/benchmarks/latency_server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

cmake_minimum_required(VERSION 3.10)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(latency_server)

find_package(eCAL REQUIRED)
Expand Down
2 changes: 0 additions & 2 deletions ecal/samples/cpp/benchmarks/latency_snd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

cmake_minimum_required(VERSION 3.10)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(latency_snd)

find_package(eCAL REQUIRED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

cmake_minimum_required(VERSION 3.10)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(many_connections_rec)

find_package(eCAL REQUIRED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

cmake_minimum_required(VERSION 3.10)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(many_connections_snd)

find_package(eCAL REQUIRED)
Expand Down
2 changes: 0 additions & 2 deletions ecal/samples/cpp/benchmarks/massive_pub_sub/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

cmake_minimum_required(VERSION 3.10)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(massive_pub_sub)

find_package(eCAL REQUIRED)
Expand Down
2 changes: 0 additions & 2 deletions ecal/samples/cpp/benchmarks/multiple_rec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

cmake_minimum_required(VERSION 3.10)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(multiple_rec)

find_package(eCAL REQUIRED)
Expand Down
2 changes: 0 additions & 2 deletions ecal/samples/cpp/benchmarks/multiple_snd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

cmake_minimum_required(VERSION 3.10)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(multiple_snd)

find_package(eCAL REQUIRED)
Expand Down
2 changes: 0 additions & 2 deletions ecal/samples/cpp/benchmarks/performance_rec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

cmake_minimum_required(VERSION 3.10)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(performance_rec)

find_package(eCAL REQUIRED)
Expand Down
2 changes: 0 additions & 2 deletions ecal/samples/cpp/benchmarks/performance_snd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

cmake_minimum_required(VERSION 3.10)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(performance_snd)

find_package(eCAL REQUIRED)
Expand Down
1 change: 0 additions & 1 deletion ecal/samples/cpp/benchmarks/perftool/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# ========================= eCAL LICENSE =================================

cmake_minimum_required(VERSION 3.13)
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(perftool)

Expand Down
2 changes: 0 additions & 2 deletions ecal/samples/cpp/benchmarks/pubsub_throughput/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

cmake_minimum_required(VERSION 3.10)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(pubsub_throughput)

find_package(eCAL REQUIRED)
Expand Down
2 changes: 0 additions & 2 deletions ecal/samples/cpp/misc/config/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

cmake_minimum_required(VERSION 3.10)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(config_sample)

find_package(eCAL REQUIRED)
Expand Down
2 changes: 0 additions & 2 deletions ecal/samples/cpp/misc/process/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

cmake_minimum_required(VERSION 3.10)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(process)

find_package(eCAL REQUIRED)
Expand Down
2 changes: 0 additions & 2 deletions ecal/samples/cpp/misc/time/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

cmake_minimum_required(VERSION 3.10)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(time)

find_package(eCAL REQUIRED)
Expand Down
2 changes: 0 additions & 2 deletions ecal/samples/cpp/misc/timer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

cmake_minimum_required(VERSION 3.10)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(timer)

find_package(eCAL REQUIRED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

cmake_minimum_required(VERSION 3.10)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(monitoring_get_services)

find_package(eCAL REQUIRED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

cmake_minimum_required(VERSION 3.10)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(monitoring_get_topics)

find_package(eCAL REQUIRED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

cmake_minimum_required(VERSION 3.10)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(monitoring_performance)

find_package(eCAL REQUIRED)
Expand Down
2 changes: 0 additions & 2 deletions ecal/samples/cpp/monitoring/monitoring_rec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

cmake_minimum_required(VERSION 3.10)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(monitoring_rec)

find_package(eCAL REQUIRED)
Expand Down
2 changes: 0 additions & 2 deletions ecal/samples/cpp/orchestration/component1/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

cmake_minimum_required(VERSION 3.10)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(component1)

find_package(eCAL REQUIRED)
Expand Down
2 changes: 0 additions & 2 deletions ecal/samples/cpp/orchestration/component2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

cmake_minimum_required(VERSION 3.10)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(component2)

find_package(eCAL REQUIRED)
Expand Down
2 changes: 0 additions & 2 deletions ecal/samples/cpp/orchestration/orchestrator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

cmake_minimum_required(VERSION 3.10)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(orchestrator)

find_package(eCAL REQUIRED)
Expand Down
2 changes: 0 additions & 2 deletions ecal/samples/cpp/pubsub/binary/binary_rec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

cmake_minimum_required(VERSION 3.10)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(binary_rec)

find_package(eCAL REQUIRED)
Expand Down
2 changes: 0 additions & 2 deletions ecal/samples/cpp/pubsub/binary/binary_snd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

cmake_minimum_required(VERSION 3.10)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(binary_snd)

find_package(eCAL REQUIRED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ cmake_minimum_required(VERSION 3.10)
project(binary_zero_copy_rec)

# set project properties
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
set(binary_zero_copy_rec_src src/binary_zero_copy_rec.cpp)

# find packages
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ cmake_minimum_required(VERSION 3.10)
project(binary_zero_copy_snd)

# set project properties
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
set(binary_zero_copy_snd_src src/binary_zero_copy_snd.cpp)

# find packages
Expand Down
2 changes: 0 additions & 2 deletions ecal/samples/cpp/pubsub/binary/ping/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

cmake_minimum_required(VERSION 3.10)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(ping)

find_package(eCAL REQUIRED)
Expand Down
2 changes: 0 additions & 2 deletions ecal/samples/cpp/pubsub/binary/pong/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

cmake_minimum_required(VERSION 3.10)

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

project(pong)

find_package(eCAL REQUIRED)
Expand Down
Loading

0 comments on commit 1381a20

Please sign in to comment.