cmake make library

{

 

cmake_minimum_required(VERSION 3.5)

project(hello_library)

# Generate static library based on the code library file
add_library (hello_library STATIC src / Hello.cpp)

# Directory containing the specified file is located in the header
target_include_directories (hello_library  the PUBLIC   $ PROJECT_SOURCE_DIR} {/ the include )

# Create the executable program

#add_executable(hello_binary
#src/main.cpp
#)

# Static link library files
target_link_libraries (hello_binary PRIVATE hello_library)

 

}

Guess you like

Origin www.cnblogs.com/YZFHKMS-X/p/12630029.html