CMAKE_MINIMUM_REQUIRED(VERSION 3.10) PROJECT(VSConfig) ### SET CONFIGURE OPTION(SUBPROJECT "AS SubProject" OFF) ADD_COMPILE_OPTIONS(-fPIC -std=c99) 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) ### 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}/)