Sample样例CMakeLists相关依赖(C++)
cmake_minimum_required(VERSION 3.5.2) project(Sample) set(EXECUTABLE_OUTPUT_PATH${CMAKE_CURRENT_SOURCE_DIR}/out/) add_compile_options(-std=c++11 -fPIE -fstack-protector-all -Wall -D_FORTIFY_SOURCE=2 -O2) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../include) link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../lib) aux_source_directory("${CMAKE_CURRENT_SOURCE_DIR}/src/." DIR_SRCS) add_executable(Sample ${DIR_SRCS}) target_link_libraries(Sample ascendhac -Wl,-z,relro,-z,now,-z,noexecstack -s -pie)
父主题: 代码参考