Skip to content

Commit

Permalink
coin-cbc: workaround for pkg-config issues
Browse files Browse the repository at this point in the history
  • Loading branch information
valgur committed Nov 26, 2023
1 parent f43eadc commit 4157e91
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
11 changes: 7 additions & 4 deletions recipes/coin-cbc/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
cmake_minimum_required(VERSION 3.15)
project(test_package LANGUAGES CXX)

#include(FindPkgConfig)
#pkg_check_modules(OsiCbc REQUIRED IMPORTED_TARGET osi-cbc)
#add_executable(${PROJECT_NAME}_pkgconfig test_package.cpp)
#target_link_libraries(${PROJECT_NAME}_pkgconfig PRIVATE PkgConfig::OsiCbc)
include(FindPkgConfig)
# The transitive 'coinutils' is added explicitly to work around the linked library order otherwise being:
# OsiCbc CbcSolver Cbc bz2 z OsiCommonTests Osi Cgl ClpSolver Clp OsiClp CoinUtils
# which causes CoinUtils to not find bz2 and z symbols.
pkg_check_modules(OsiCbc REQUIRED IMPORTED_TARGET osi-cbc coinutils)
add_executable(${PROJECT_NAME}_pkgconfig test_package.cpp)
target_link_libraries(${PROJECT_NAME}_pkgconfig PRIVATE PkgConfig::OsiCbc)

find_package(coin-cbc CONFIG REQUIRED)
add_executable(${PROJECT_NAME}_cmake test_package.cpp)
Expand Down
4 changes: 2 additions & 2 deletions recipes/coin-cbc/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def build(self):

def test(self):
if can_run(self):
# bin_path = os.path.join(self.cpp.build.bindir, "test_package_pkgconfig")
# self.run(bin_path, env="conanrun")
bin_path = os.path.join(self.cpp.build.bindir, "test_package_pkgconfig")
self.run(bin_path, env="conanrun")
bin_path = os.path.join(self.cpp.build.bindir, "test_package_cmake")
self.run(bin_path, env="conanrun")
4 changes: 2 additions & 2 deletions recipes/coin-cbc/all/test_v1_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def build(self):

def test(self):
if not tools.cross_building(self.settings):
# bin_path = os.path.join("bin", "test_package_pkgconfig")
# self.run(bin_path, run_environment=True)
bin_path = os.path.join("bin", "test_package_pkgconfig")
self.run(bin_path, run_environment=True)
bin_path = os.path.join("bin", "test_package_cmake")
self.run(bin_path, run_environment=True)

0 comments on commit 4157e91

Please sign in to comment.