vcpkg/ports/clp/CMakeLists.txt
Victor Romero 050e71d01d
Remove references to CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS (#5937)
* [various ports] remove references to CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS

* [alac,benchmark,capnproto] Fix  check_linkage call

* [fastlz] Fix SHA512

* [coroutine] Fix dynamic build

* [folly] Find double-conversion

* [gamma] Use vcpkg_from_github

* [librsync] Enable static builds

* [netcdf-cxx4] Fix SHA512

* [octomap] Fix static build

* [tidy-html5] Fix static build

* [various ports] remove custom messages for shared/static builds, modernize some scripts in the meantime

* [folly] Use ras0219's fix for link paths

* [octomap] Fix exported targets

* [uvatlas] Set tool download SHA512

* [duktape+python2] fix portfile to call configure with correct python version, manage python2 also outside win32

* [suitesparse] osx fix

* [gtkmm] Call vcpkg_check_linkage after including vcpkg functions

* [duktape] Resolve conflicts

* [duktape] FIxed typo in Python paths

* [wangle] Find zlib

* [openssl-uwp] Fix SHA512

* [glib] Allow static builds on non-Windows

* [suitesparse] Fix build on Windows

* [multiple ports] Bump CONTROL version

* [multiple ports] Fix description indent

* [directxtk] Fix CONTROL file

* [bde,duktape,qpid-proton] Build packages with python2 installed

* [binn] remove CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS

* [gdal,live555,uriparser] Fix regressions

* [live555] Update to 2019.04.24
2019-05-02 22:57:43 -07:00

140 lines
4.5 KiB
CMake

cmake_minimum_required(VERSION 3.11)
project(Clp LANGUAGES C CXX)
set(PROJECT_VERSION 1.16.11)
set(PROJECT_VERSION_MAJOR 1)
set(PROJECT_VERSION_MINOR 16)
set(PROJECT_VERSION_PATCH 11)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake")
if(MSVC)
set(
CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} /bigobj /MP /wd4996 /wd4819 /wd4251 /wd4267 /wd4244 /wd4275"
)
endif(MSVC)
if(APPLE)
set(
CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -Wno-inconsistent-missing-override -Wno-unused-command-line-argument -Wno-unused-result -Wno-exceptions"
)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9"
CACHE STRING "Minimum OS X deployment version")
endif(APPLE)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# options
option(BUILD_SHARED_LIBS "" ON)
#
# Introduce variables: * CMAKE_INSTALL_LIBDIR * CMAKE_INSTALL_BINDIR
include(GNUInstallDirs)
# Include module with fuction 'write_basic_package_version_file'
include(CMakePackageConfigHelpers)
# Layout. This works for all platforms: * <prefix>/lib*/cmake/<PROJECT-NAME> *
# <prefix>/lib*/ * <prefix>/include/
set(config_install_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
# Configuration
set(version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake")
set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake")
set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
set(namespace "Coin::")
# Packages
find_package(CoinUtils REQUIRED)
find_package(Osi REQUIRED)
# Add sources
include_directories(Clp/src/)
include_directories(Clp/src/OsiClp)
file(GLOB CLP_SOURCES
Clp/src/*.hpp
Clp/src/*.cpp
Clp/src/OsiClp/*.hpp
Clp/src/OsiClp/*.cpp)
file(GLOB CLP_REMOVE
Clp/src/ClpCholeskyMumps.cpp
Clp/src/ClpCholeskyUfl.cpp
Clp/src/ClpCholeskyWssmp.cpp
Clp/src/ClpCholeskyWssmpKKT.cpp
Clp/src/ClpMain.cpp
Clp/src/*Abc*.cpp
Clp/src/ClpCholeskyMumps.hpp
Clp/src/ClpCholeskyUfl.hpp
Clp/src/ClpCholeskyWssmp.hpp
Clp/src/ClpCholeskyWssmpKKT.hpp
Clp/src/ClpMain.hpp
Clp/src/*Abc*.hpp
Clp/src/*Abc*.h)
list(REMOVE_ITEM CLP_SOURCES ${CLP_REMOVE})
add_library(${PROJECT_NAME} ${CLP_SOURCES})
target_include_directories(${PROJECT_NAME}
PUBLIC $<INSTALL_INTERFACE:include/coin>)
target_compile_definitions(${PROJECT_NAME}
PUBLIC
-DHAVE_CMATH
-D_CRT_SECURE_NO_WARNINGS
-DCOIN_HAS_CLP)
target_link_libraries(${PROJECT_NAME} PRIVATE Coin::CoinUtils Coin::Osi)
install(TARGETS ${PROJECT_NAME}
EXPORT "${TARGETS_EXPORT_NAME}"
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES
DESTINATION include)
install(DIRECTORY Clp/src/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/coin
FILES_MATCHING
PATTERN "*.h"
PATTERN "*.hpp"
PATTERN "config_default.h"
EXCLUDE)
install(DIRECTORY Clp/src/OsiClp/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/coin
FILES_MATCHING
PATTERN "*.h"
PATTERN "*.hpp"
PATTERN "config_default.h"
EXCLUDE)
#
# Install Libraries
#
# Configure '<PROJECT-NAME>ConfigVersion.cmake' Use: * PROJECT_VERSION
write_basic_package_version_file("${version_config}"
COMPATIBILITY SameMajorVersion)
# Configure '<PROJECT-NAME>Config.cmake' Use variables: * TARGETS_EXPORT_NAME *
# PROJECT_NAME
configure_package_config_file("Config.cmake.in"
"${project_config}"
INSTALL_DESTINATION
"${config_install_dir}")
# Config * <prefix>/lib/cmake/Foo/FooConfig.cmake *
# <prefix>/lib/cmake/Foo/FooConfigVersion.cmake
install(FILES "${project_config}" "${version_config}"
DESTINATION "${config_install_dir}")
# Config * <prefix>/lib/cmake/Foo/FooTargets.cmake
install(EXPORT "${TARGETS_EXPORT_NAME}"
NAMESPACE "${namespace}"
DESTINATION "${config_install_dir}")