Skip to content

Commit

Permalink
Merge branch 'lib64' into 'bugfix-60'
Browse files Browse the repository at this point in the history
Use environment variables included rom GNUInstallDirs instead of harcoded lib, bin, include paths

See merge request integer/soplex!403
  • Loading branch information
ju-manns committed Jul 13, 2023
2 parents 66a269e + 5e6259b commit 950b165
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
function(setLibProperties targetname outputname)
set_target_properties(${targetname} PROPERTIES
OUTPUT_NAME ${outputname}
MACOSX_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
MACOSX_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
endfunction(setLibProperties)

include(GNUInstallDirs)

include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR})

set(sources
Expand Down Expand Up @@ -201,18 +203,18 @@ add_executable(example EXCLUDE_FROM_ALL example.cpp)
target_link_libraries(example libsoplex)

# set the install rpath to the installed destination
set_target_properties(soplex PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set_target_properties(soplex PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")

# install the header files of soplex
install(FILES ${headers} ${PROJECT_BINARY_DIR}/soplex/config.h DESTINATION include/soplex)
install(FILES soplex.h soplex.hpp soplex_interface.h DESTINATION include)
install(FILES ${headers} ${PROJECT_BINARY_DIR}/soplex/config.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/soplex)
install(FILES soplex.h soplex.hpp soplex_interface.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

# install the binary and the library to appropriate lcoations and add them to an export group
install(TARGETS soplex libsoplex libsoplex-pic libsoplexshared EXPORT soplex-targets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include)
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

# Add library targets to the build-tree export set
export(TARGETS libsoplex libsoplex-pic libsoplexshared
Expand All @@ -238,7 +240,7 @@ configure_file(${PROJECT_SOURCE_DIR}/soplex-config.cmake.in

# install the targets of the soplex export group and the config file so that other projects
# can link easily against soplex
install(EXPORT soplex-targets FILE soplex-targets.cmake DESTINATION lib/cmake/soplex)
install(EXPORT soplex-targets FILE soplex-targets.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/soplex)
install(FILES "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/soplex-config.cmake"
${CMAKE_BINARY_DIR}/soplex-config-version.cmake
DESTINATION lib/cmake/soplex)
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/soplex)

0 comments on commit 950b165

Please sign in to comment.