mirror of
https://github.com/ttroy50/cmake-examples.git
synced 2025-12-18 20:24:35 +03:00
34 lines
783 B
CMake
34 lines
783 B
CMake
cmake_minimum_required(VERSION 3.5)
|
|
|
|
project(hello_library)
|
|
|
|
############################################################
|
|
# Create a library
|
|
############################################################
|
|
|
|
#Generate the static library from the library sources
|
|
add_library(hello_library STATIC
|
|
src/Hello.cpp
|
|
)
|
|
|
|
target_include_directories(hello_library
|
|
PUBLIC
|
|
${PROJECT_SOURCE_DIR}/include
|
|
)
|
|
|
|
|
|
############################################################
|
|
# Create an executable
|
|
############################################################
|
|
|
|
# Add an executable with the above sources
|
|
add_executable(hello_binary
|
|
src/main.cpp
|
|
)
|
|
|
|
# link the new hello_library target with the hello_binary target
|
|
target_link_libraries( hello_binary
|
|
PRIVATE
|
|
hello_library
|
|
)
|