AW-Sm-Rpc/utils/VSConfig/CMakeLists.txt
2024-03-30 13:55:27 +08:00

42 lines
808 B
CMake
Executable File

CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
PROJECT(VSConfig)
### SET CONFIGURE
OPTION(SUBPROJECT "AS SubProject" OFF)
ADD_COMPILE_OPTIONS(-fPIC)
SET(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}/bin)
### SET COMPILE
AUX_SOURCE_DIRECTORY(${PROJECT_SOURCE_DIR}/src src_list)
if(SUBPROJECT)
ADD_LIBRARY(${PROJECT_NAME} STATIC ${src_list})
else()
ADD_LIBRARY(${PROJECT_NAME} SHARED ${src_list})
endif()
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME}
PUBLIC
${PROJECT_SOURCE_DIR}/include)
TARGET_LINK_LIBRARIES(${PROJECT_NAME}
PUBLIC
cJSON)
### SET INSTALL
if(NOT SUBPROJECT)
INSTALL(TARGETS ${CMAKE_PROJECT_NAME}
LIBRARY DESTINATION lib)
endif()
FILE(GLOB INCLUDE "${PROJECT_SOURCE_DIR}/include/*.h" )
INSTALL(FILES
${INCLUDE} DESTINATION include/${CMAKE_PROJECT_NAME}/)