1 Star 0 Fork 0

guochaoyu/nosal

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
CMakeLists.txt 3.82 KB
一键复制 编辑 原始数据 按行查看 历史
guochaoyu 提交于 2023-11-23 16:24 . cmake:demo
cmake_minimum_required(VERSION 3.16)
project(nosal C CXX)
#set(NOSAL_TARGET_MACHINE QNX-SA8155)
# Use the currently recommended way to set a default value for CMAKE_INSTALL_PREFIX;
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "/tmp/nosal" CACHE STRING "Install location" FORCE)
endif()
# Allow to build the unit tests as well.
set(NOSAL_ENABLE_TESTS ON CACHE BOOL "Build the unit tests as well")
# This is for the nosal.cmake, which is needed by all our modules.
# We install it to this location, so let's make it accessible to all.
list(APPEND CMAKE_MODULE_PATH ${CMAKE_INSTALL_PREFIX}/share/cmake-${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}/Modules)
# These are for the PkgConfig module
#list(APPEND CMAKE_PREFIX_PATH /usr/local/poco)
if(NOSAL_TARGET_MACHINE STREQUAL "QNX-SA8155")
else()
# These are for finding GTest and GMock
#set(GTEST_ROOT /usr/local/gtest)
#list(APPEND CMAKE_LIBRARY_PATH /usr/local/gtest/lib)
endif()
# CMake's usual "list" separation with ";" does not work when passing on to ExternalProject
string(REPLACE ";" "%" CMAKE_MODULE_PATH_FIXED "${CMAKE_MODULE_PATH}")
string(REPLACE ";" "%" CMAKE_PREFIX_PATH_FIXED "${CMAKE_PREFIX_PATH}")
string(REPLACE ";" "%" CMAKE_LIBRARY_PATH_FIXED "${CMAKE_LIBRARY_PATH}")
set(NOSAL_APP_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/opt")
message("Start configuring top level project : ${PROJECT_NAME}")
message("Generating using CMake version: " ${CMAKE_MAJOR_VERSION} "." ${CMAKE_MINOR_VERSION} "." ${CMAKE_PATCH_VERSION})
include(ExternalProject)
function(nosal_add_project NOSAL_NAME NOSAL_PATH)
ExternalProject_Add(${NOSAL_NAME}
SOURCE_DIR ${PROJECT_SOURCE_DIR}/${NOSAL_PATH}
LIST_SEPARATOR %
BUILD_ALWAYS 1
CMAKE_ARGS
--no-warn-unused-cli
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH_FIXED}
-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH_FIXED}
-DCMAKE_LIBRARY_PATH=${CMAKE_LIBRARY_PATH_FIXED}
-DGTEST_ROOT=${GTEST_ROOT}
-DNOSAL_ENABLE_TESTS=${NOSAL_ENABLE_TESTS}
-DNOSAL_APP_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}/opt
-DNOSAL_TARGET_MACHINE=${NOSAL_TARGET_MACHINE}
)
if (${ARGC} GREATER 2)
message("Adding dependencies: ${NOSAL_NAME} -> ${ARGN}")
ExternalProject_Add_StepDependencies(${NOSAL_NAME} build ${ARGN})
endif()
endfunction()
# Define "wrapper targets" for all our modules, including their dependencies.
nosal_add_project(nosal_cmake_modules cmake_modules)
nosal_add_project(nosal_demo_lib demo/lib nosal_cmake_modules)
nosal_add_project(nosal_demo_app demo/app nosal_cmake_modules
nosal_demo_lib)
nosal_add_project(nosal_demo_svc demo/svc nosal_cmake_modules
nosal_demo_lib)
#nosal_add_project(nosal_demo_test demo/test nosal_cmake_modules
# nosal_demo_lib)
#nosal_add_project(nosal_core core nosal_cmake_modules)
#
#nosal_add_project(nosal_log log nosal_cmake_modules
# nosal_core)
#nosal_add_project(nosal_exec exec nosal_cmake_modules
# nosal_core
# nosal_log)
#
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/guochaoyu/nosal.git
git@gitee.com:guochaoyu/nosal.git
guochaoyu
nosal
nosal
master

搜索帮助