1 Star 0 Fork 2

jack / utils

forked from 极简美 / utils 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
CMakeLists.txt 1.56 KB
一键复制 编辑 原始数据 按行查看 历史
极简美 提交于 2023-01-30 17:22 . 更新构建模板
cmake_minimum_required(VERSION 3.12)
#Component name, default the same as directory name
get_filename_component(component_dir ${CMAKE_PARENT_LIST_FILE} DIRECTORY)
get_filename_component(component_name ${component_dir} NAME)
project(${component_name})
unset(COMPONENT_NAME)
unset(COMPONENT_UPPER_NAME)
# set(COMPONENT_NAME template)
set(COMPONENT_NAME ${PROJECT_NAME})
string(TOUPPER ${COMPONENT_NAME} COMPONENT_UPPER_NAME)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/commit.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/option.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/include.cmake)
if(NOT DEFINED BUILD_STATIC_LIBS)
set(BUILD_STATIC_LIBS ON)
endif()
if(NOT DEFINED BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS ON)
endif()
if(NOT DEFINED BUILD_EXAMPLES)
set(BUILD_EXAMPLES ON)
endif()
if(NOT DEFINED BUILD_TESTS)
set(BUILD_TESTS ON)
endif()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build, options are: Debug | Release." FORCE)
endif()
add_subdirectory(source)
if(${BUILD_EXAMPLES} STREQUAL "ON")
add_subdirectory(example)
endif()
if(${BUILD_TESTS} STREQUAL "ON")
add_subdirectory(unittest)
endif()
######################################################################
# uninstall targget
if(NOT TARGET uninstall)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()
C
1
https://gitee.com/jack998/utils.git
git@gitee.com:jack998/utils.git
jack998
utils
utils
master

搜索帮助