[liblemon] Fix cmake config (#33130)

* [liblemon] Fix cmake config

* update version database

* update patch

* update version database
This commit is contained in:
Weihang Ding 2023-08-15 08:28:50 +08:00 committed by GitHub
parent 0789630513
commit d695b9fda1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 89 additions and 91 deletions

View File

@ -1,34 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 03e1cc7..fd9d737 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -280,6 +280,13 @@ ELSEIF(WIN32)
)
ENDIF()
+install(
+ EXPORT lemon-targets
+ FILE lemon-config.cmake
+ NAMESPACE lemon::
+ DESTINATION share/lemon
+)
+
CONFIGURE_FILE(
${PROJECT_SOURCE_DIR}/cmake/version.cmake.in
${PROJECT_BINARY_DIR}/cmake/version.cmake
diff --git a/lemon/CMakeLists.txt b/lemon/CMakeLists.txt
index 4e6567e..76f9cae 100644
--- a/lemon/CMakeLists.txt
+++ b/lemon/CMakeLists.txt
@@ -71,6 +71,11 @@ INSTALL(
COMPONENT library
)
+install(TARGETS lemon EXPORT lemon-targets
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+)
+
INSTALL(
DIRECTORY . bits concepts
DESTINATION include/lemon

View File

@ -1,50 +1,78 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9a7c918..3d6cf35 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -268,7 +268,7 @@ CONFIGURE_FILE(
${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake
@ONLY
)
-IF(UNIX)
+IF(UNIX OR TRUE)
INSTALL(
FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake
DESTINATION share/lemon/cmake
@@ -282,9 +282,9 @@ ENDIF()
install(
EXPORT lemon-targets
- FILE lemon-config.cmake
- NAMESPACE lemon::
- DESTINATION share/lemon
+ FILE lemon-targets.cmake
+ NAMESPACE unofficial::lemon::
+ DESTINATION share/lemon/cmake
)
CONFIGURE_FILE(
diff --git a/cmake/LEMONConfig.cmake.in b/cmake/LEMONConfig.cmake.in
index b0d2d8b..ce54986 100644
--- a/cmake/LEMONConfig.cmake.in
+++ b/cmake/LEMONConfig.cmake.in
@@ -1,4 +1,4 @@
-SET(LEMON_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include" CACHE PATH "LEMON include directory")
+SET(LEMON_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../include" CACHE PATH "LEMON include directory")
SET(LEMON_INCLUDE_DIRS "${LEMON_INCLUDE_DIR}")
IF(UNIX)
@@ -7,7 +7,12 @@ ELSEIF(WIN32)
SET(LEMON_LIB_NAME "lemon.lib")
ENDIF(UNIX)
-SET(LEMON_LIBRARY "@CMAKE_INSTALL_PREFIX@/lib/${LEMON_LIB_NAME}" CACHE FILEPATH "LEMON library")
+SET(LEMON_LIBRARY
+ optimized "${CMAKE_CURRENT_LIST_DIR}/../../lib/${LEMON_LIB_NAME}"
+ debug "${CMAKE_CURRENT_LIST_DIR}/../../debug/lib/${LEMON_LIB_NAME}"
+ CACHE FILEPATH "LEMON library")
SET(LEMON_LIBRARIES "${LEMON_LIBRARY}")
MARK_AS_ADVANCED(LEMON_LIBRARY LEMON_INCLUDE_DIR)
+
+include(${CMAKE_CURRENT_LIST_DIR}/lemon-targets.cmake)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4406bc2..5717680 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -295,7 +295,7 @@ CONFIGURE_FILE(
${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake
@ONLY
)
-IF(UNIX)
+IF(UNIX OR TRUE)
INSTALL(
FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake
DESTINATION share/lemon/cmake
@@ -307,6 +307,13 @@ ELSEIF(WIN32)
)
ENDIF()
+install(
+ EXPORT lemon-targets
+ FILE lemon-targets.cmake
+ NAMESPACE unofficial::lemon::
+ DESTINATION share/lemon/cmake
+)
+
CONFIGURE_FILE(
${PROJECT_SOURCE_DIR}/cmake/version.cmake.in
${PROJECT_BINARY_DIR}/cmake/version.cmake
diff --git a/cmake/LEMONConfig.cmake.in b/cmake/LEMONConfig.cmake.in
index b0d2d8b..6bb662a 100644
--- a/cmake/LEMONConfig.cmake.in
+++ b/cmake/LEMONConfig.cmake.in
@@ -1,4 +1,4 @@
-SET(LEMON_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include" CACHE PATH "LEMON include directory")
+SET(LEMON_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../include" CACHE PATH "LEMON include directory")
SET(LEMON_INCLUDE_DIRS "${LEMON_INCLUDE_DIR}")
IF(UNIX)
@@ -7,7 +7,12 @@ ELSEIF(WIN32)
SET(LEMON_LIB_NAME "lemon.lib")
ENDIF(UNIX)
-SET(LEMON_LIBRARY "@CMAKE_INSTALL_PREFIX@/lib/${LEMON_LIB_NAME}" CACHE FILEPATH "LEMON library")
+SET(LEMON_LIBRARY
+ optimized "${CMAKE_CURRENT_LIST_DIR}/../../lib/${LEMON_LIB_NAME}"
+ debug "${CMAKE_CURRENT_LIST_DIR}/../../debug/lib/${LEMON_LIB_NAME}"
+ CACHE FILEPATH "LEMON library")
SET(LEMON_LIBRARIES "${LEMON_LIBRARY}")
MARK_AS_ADVANCED(LEMON_LIBRARY LEMON_INCLUDE_DIR)
+
+INCLUDE(${CMAKE_CURRENT_LIST_DIR}/lemon-targets.cmake)
diff --git a/lemon/CMakeLists.txt b/lemon/CMakeLists.txt
index 4e6567e..ad6f5bf 100644
--- a/lemon/CMakeLists.txt
+++ b/lemon/CMakeLists.txt
@@ -56,6 +56,10 @@ ENDIF()
ADD_LIBRARY(lemon ${LEMON_SOURCES})
+INCLUDE(GNUInstallDirs)
+
+TARGET_INCLUDE_DIRECTORIES(lemon PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
+
TARGET_LINK_LIBRARIES(lemon
${GLPK_LIBRARIES} ${COIN_LIBRARIES} ${ILOG_LIBRARIES} ${SOPLEX_LIBRARIES}
)
@@ -71,6 +75,11 @@ INSTALL(
COMPONENT library
)
+install(TARGETS lemon EXPORT lemon-targets
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+)
+
INSTALL(
DIRECTORY . bits concepts
DESTINATION include/lemon

View File

@ -13,8 +13,7 @@ vcpkg_extract_source_archive(
ARCHIVE "${ARCHIVE}"
SOURCE_BASE "${VERSION}"
PATCHES
cmake.patch
fixup-targets.patch
fix-cmake.patch
)
vcpkg_cmake_configure(
@ -30,6 +29,8 @@ vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH share/lemon/cmake PACKAGE_NAME lemon)
vcpkg_fixup_pkgconfig()
file(GLOB EXE "${CURRENT_PACKAGES_DIR}/bin/*.exe")
file(COPY ${EXE} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/liblemon/")
vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/liblemon")
@ -39,6 +40,4 @@ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/doc")
# Handle copyright
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
vcpkg_fixup_pkgconfig()
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

View File

@ -1,7 +1,7 @@
{
"name": "liblemon",
"version-date": "2019-06-13",
"port-version": 6,
"port-version": 7,
"description": "Library for Efficient Modeling and Optimization in Networks",
"homepage": "https://lemon.cs.elte.hu/trac/lemon",
"dependencies": [

View File

@ -4278,7 +4278,7 @@
},
"liblemon": {
"baseline": "2019-06-13",
"port-version": 6
"port-version": 7
},
"liblinear": {
"baseline": "243",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "e7357874ce9b71f43cb1c298dbb1228ac9241a69",
"version-date": "2019-06-13",
"port-version": 7
},
{
"git-tree": "b51839207be0c83364a5fa07660067ea774cc814",
"version-date": "2019-06-13",