加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
CMakeLists.txt 1.64 KB
一键复制 编辑 原始数据 按行查看 历史
陈程 提交于 2022-03-10 20:40 . 适配 BUILD.gn 脚本
cmake_minimum_required(VERSION 3.15)
project(restool)
set(CMAKE_CXX_STANDARD 17)
if (WIN32)
set(CMAKE_EXE_LINKER_FLAGS "-static -s")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -fstack-protector -DLIBXML_STATIC -Wno-attributes")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -fstack-protector -Wno-attributes")
elseif (APPLE)
set(CMAKE_EXE_LINKER_FLAGS "-fPIE -pie -static-libgcc -static-libstdc++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -fstack-protector -O2 -g -Wall")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -fstack-protector")
else()
set(CMAKE_EXE_LINKER_FLAGS "-Wl,-z,relro,-z,now -fPIE -pie -Wl,-z,noexecstack -s -static-libgcc -static-libstdc++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -fstack-protector -O2 -g -Wall")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -fstack-protector")
endif()
set(jsoncpp_dir ${CMAKE_SOURCE_DIR}/../../third_party/jsoncpp)
set(bound_checking_function_dir ${CMAKE_SOURCE_DIR}/../../third_party/bounds_checking_function)
set(libxml2_dir ${CMAKE_SOURCE_DIR}/../../third_party/libxml2)
set(sqlite3_dir ${CMAKE_SOURCE_DIR}/../../third_party/sqlite)
include_directories(include)
include_directories(${jsoncpp_dir}/include)
include_directories(${bound_checking_function_dir}/include)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/build/libxml2/include)
include_directories(${sqlite3_dir}/include)
aux_source_directory(src restool_source)
aux_source_directory(src/xml restool_source)
add_executable(restool ${restool_source})
target_link_libraries(restool myxml2 jsoncpp securec sqlite3)
add_subdirectory(build/libxml2)
add_subdirectory(build/jsoncpp)
add_subdirectory(build/bounds_checking_function)
add_subdirectory(build/sqlite3)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化