Files
cmake-examples/01-basic/E-installing/CMakeLists.txt
Thom Troy b81da6f68b Update to minimum CMake 3.5
And modernise some examples.
2018-03-18 17:23:57 +00:00

54 lines
1.3 KiB
CMake

cmake_minimum_required(VERSION 3.5)
project(cmake_examples_install)
############################################################
# Create a library
############################################################
#Generate the shared library from the library sources
add_library(cmake_examples_inst SHARED
src/Hello.cpp
)
target_include_directories(cmake_examples_inst
PUBLIC
${PROJECT_SOURCE_DIR}/include
)
############################################################
# Create an executable
############################################################
# Add an executable with the above sources
add_executable(cmake_examples_inst_bin
src/main.cpp
)
# link the new hello_library target with the hello_binary target
target_link_libraries( cmake_examples_inst_bin
PRIVATE
cmake_examples_inst
)
############################################################
# Install
############################################################
# Binaries
install (TARGETS cmake_examples_inst_bin
DESTINATION bin)
# Library
# Note: may not work on windows
install (TARGETS cmake_examples_inst
LIBRARY DESTINATION lib)
# Header files
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/
DESTINATION include)
# Config
install (FILES cmake-examples.conf
DESTINATION etc)