cmake_minimum_required(VERSION 3.5)
project (testmath)
#静态库
add_library(libmyadd STATIC IMPORTED)
set_target_properties(libmyadd PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "/opt/work/myadd"
IMPORTED_LOCATION "/opt/work/myadd/libmyadd.a"
)
#动态库
add_library(libmysub SHARED IMPORTED)
set_target_properties(libmysub PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "/opt/work/mysub"
IMPORTED_LOCATION "/opt/work/mysub/libmysub.so"
)
#header only 库
add_library(libhadd INTERFACE IMPORTED)
set_target_properties(libhadd PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "/opt/work/headeronlyadd"
)
add_executable(testmath testmath.cpp)
target_link_libraries(testmath
PRIVATE libmyadd
PRIVATE libmysub
PRIVATE libhadd
)