mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 21:31:08 -06:00
Tutorial: MultiPackage now correctly compiles
This commit is contained in:
committed by
Brad King
parent
a1c6d7e9af
commit
98164b707f
@@ -1,19 +1,26 @@
|
|||||||
cmake_minimum_required(VERSION 3.3)
|
cmake_minimum_required(VERSION 3.3)
|
||||||
project(Tutorial)
|
project(Tutorial)
|
||||||
|
|
||||||
# control how we mark up Debug libraries compared to Release libraries
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
set(CMAKE_DEBUG_POSTFIX "-d")
|
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||||
|
|
||||||
|
# set the version number
|
||||||
|
set(Tutorial_VERSION_MAJOR 1)
|
||||||
|
set(Tutorial_VERSION_MINOR 0)
|
||||||
|
|
||||||
# control where the static and shared libraries are built so that on windows
|
# control where the static and shared libraries are built so that on windows
|
||||||
# we don't need to tinker with the path to run the executable
|
# we don't need to tinker with the path to run the executable
|
||||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
|
||||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
|
||||||
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
|
||||||
|
|
||||||
option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
|
option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
|
||||||
|
|
||||||
# the version number.
|
if(APPLE)
|
||||||
set(Tutorial_VERSION_MAJOR 1)
|
set(CMAKE_INSTALL_RPATH "@executable_path/../lib")
|
||||||
set(Tutorial_VERSION_MINOR 0)
|
elseif(UNIX)
|
||||||
|
set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib")
|
||||||
|
endif()
|
||||||
|
|
||||||
# configure a header file to pass the version number only
|
# configure a header file to pass the version number only
|
||||||
configure_file(
|
configure_file(
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
# add the library that runs
|
# add the library that runs
|
||||||
add_library(MathFunctions MathFunctions.cxx)
|
add_library(MathFunctions MathFunctions.cxx)
|
||||||
|
|
||||||
@@ -62,6 +61,7 @@ target_compile_definitions(MathFunctions PRIVATE "EXPORTING_MYMATH")
|
|||||||
set_property(TARGET MathFunctions PROPERTY VERSION "1.0.0")
|
set_property(TARGET MathFunctions PROPERTY VERSION "1.0.0")
|
||||||
set_property(TARGET MathFunctions PROPERTY SOVERSION "1")
|
set_property(TARGET MathFunctions PROPERTY SOVERSION "1")
|
||||||
|
|
||||||
|
# install rules
|
||||||
install(TARGETS MathFunctions
|
install(TARGETS MathFunctions
|
||||||
DESTINATION lib
|
DESTINATION lib
|
||||||
EXPORT MathFunctionsTargets)
|
EXPORT MathFunctionsTargets)
|
||||||
|
|||||||
Reference in New Issue
Block a user