• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1cmake_minimum_required(VERSION 3.15)
2project(restool)
3set(CMAKE_CXX_STANDARD 17)
4if (WIN32)
5set(CMAKE_EXE_LINKER_FLAGS "-static -s")
6set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -fstack-protector -DLIBXML_STATIC -Wno-attributes")
7set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -fstack-protector -Wno-attributes")
8elseif (APPLE)
9set(CMAKE_EXE_LINKER_FLAGS "-fPIE -pie -static-libgcc -static-libstdc++")
10set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -fstack-protector -O2 -g -Wall")
11set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -fstack-protector")
12else()
13set(CMAKE_EXE_LINKER_FLAGS "-Wl,-z,relro,-z,now -fPIE -pie -Wl,-z,noexecstack -s -static-libgcc -static-libstdc++")
14set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -fstack-protector -O2 -g -Wall")
15set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -fstack-protector")
16endif()
17
18set(jsoncpp_dir ${CMAKE_SOURCE_DIR}/../../third_party/jsoncpp)
19set(png_dir ${CMAKE_SOURCE_DIR}/../../third_party/libpng)
20set(zlib_dir ${CMAKE_SOURCE_DIR}/../../third_party/zlib)
21set(bound_checking_function_dir ${CMAKE_SOURCE_DIR}/../../third_party/bounds_checking_function)
22
23include_directories(include)
24include_directories(${jsoncpp_dir}/include)
25include_directories(${png_dir}/)
26include_directories(${bound_checking_function_dir}/include)
27
28aux_source_directory(src restool_source)
29
30aux_source_directory(${bound_checking_function_dir}/src lib_sec_source)
31add_library(securec STATIC ${lib_sec_source})
32
33aux_source_directory(${jsoncpp_dir}/src/lib_json json_source)
34add_library(jsoncpp STATIC ${json_source})
35
36aux_source_directory(${zlib_dir}/ zlib_source)
37add_library(zlib STATIC ${zlib_source})
38
39aux_source_directory(${png_dir}/ png_source)
40add_library(png STATIC ${png_source})
41
42add_executable(restool ${restool_source})
43target_link_libraries(restool jsoncpp securec zlib png)