|
| 1 | +cmake_minimum_required(VERSION 3.10) |
| 2 | + |
| 3 | +set(CMAKE_CXX_STANDARD 20) |
| 4 | +set(CMAKE_CXX_STANDARD_REQUIRED ON) |
| 5 | +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) |
| 6 | + |
| 7 | +project(dynamicarray VERSION 1.0) |
| 8 | + |
| 9 | +include(run.cmake) |
| 10 | + |
| 11 | +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS}-D _DEBUG -ggdb3 -std=c++2a -O0 -Wall -Wextra\ |
| 12 | + -Weffc++ -Waggressive-loop-optimizations -Wc++14-compat -Wmissing-declarations\ |
| 13 | + -Wcast-align -Wcast-qual -Wchar-subscripts -Wconditionally-supported -Wconversion\ |
| 14 | + -Wctor-dtor-privacy -Wempty-body -Wfloat-equal -Wformat-nonliteral -Wformat-security\ |
| 15 | + -Wformat-signedness -Wformat=2 -Winline -Wlogical-op -Wnon-virtual-dtor -Wopenmp-simd\ |
| 16 | + -Woverloaded-virtual -Wpacked -Wpointer-arith -Winit-self -Wredundant-decls -Wshadow\ |
| 17 | + -Wsign-conversion -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=2\ |
| 18 | + -Wsuggest-attribute=noreturn -Wsuggest-final-methods -Wsuggest-final-types\ |
| 19 | + -Wsuggest-override -Wswitch-default -Wsync-nand -Wundef -Wunreachable-code\ |
| 20 | + -Wunused -Wuseless-cast -Wvariadic-macros -Wno-literal-suffix -Wno-missing-field-initializers\ |
| 21 | + -Wno-narrowing -Wno-old-style-cast -Wno-varargs -Wstack-protector -Wswitch-enum\ |
| 22 | + -fcheck-new -fsized-deallocation\ |
| 23 | + -fstack-protector -fstrict-overflow -flto-odr-type-merging -fno-omit-frame-pointer -fPIE\ |
| 24 | + -fsanitize=address,alignment,bool,bounds,enum,float-cast-overflow,float-divide-by-zero,integer-divide-by-zero,leak,nonnull-attribute,null,object-size,return,returns-nonnull-attribute,shift,signed-integer-overflow,undefined,unreachable,vla-bound,vptr\ |
| 25 | + -pie -Wlarger-than=8192 -Wstack-usage=8192") |
| 26 | + |
| 27 | +set(CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS}-D _DEBUG -ggdb3 -std=c++2a -O0 -Wall -Wextra\ |
| 28 | + -Weffc++ -Waggressive-loop-optimizations -Wc++14-compat -Wmissing-declarations\ |
| 29 | + -Wcast-align -Wcast-qual -Wchar-subscripts -Wconditionally-supported -Wconversion\ |
| 30 | + -Wctor-dtor-privacy -Wempty-body -Wfloat-equal -Wformat-nonliteral -Wformat-security\ |
| 31 | + -Wformat-signedness -Wformat=2 -Winline -Wlogical-op -Wnon-virtual-dtor -Wopenmp-simd\ |
| 32 | + -Woverloaded-virtual -Wpacked -Wpointer-arith -Winit-self -Wredundant-decls -Wshadow\ |
| 33 | + -Wsign-conversion -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=2\ |
| 34 | + -Wsuggest-attribute=noreturn -Wsuggest-final-methods -Wsuggest-final-types\ |
| 35 | + -Wsuggest-override -Wswitch-default -Wsync-nand -Wundef -Wunreachable-code\ |
| 36 | + -Wunused -Wuseless-cast -Wvariadic-macros -Wno-literal-suffix -Wno-missing-field-initializers\ |
| 37 | + -Wno-narrowing -Wno-old-style-cast -Wno-varargs -Wstack-protector -Wswitch-enum\ |
| 38 | + -fcheck-new -fsized-deallocation\ |
| 39 | + -fstack-protector -fstrict-overflow -flto-odr-type-merging -fno-omit-frame-pointer -fPIE\ |
| 40 | + -fsanitize=address,alignment,bool,bounds,enum,float-cast-overflow,float-divide-by-zero,integer-divide-by-zero,leak,nonnull-attribute,null,object-size,return,returns-nonnull-attribute,shift,signed-integer-overflow,undefined,unreachable,vla-bound,vptr\ |
| 41 | + -pie -Wlarger-than=8192 -Wstack-usage=8192") |
| 42 | + |
| 43 | +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS}-D NLOGS -std=c++2a -Ofast -Wall") |
| 44 | +set(CMAKE_LINKER_FLAGS_RELEASE "${CMAKE_LINKER_FLAGS}-D NLOGS -std=c++2a -Ofast -Wall") |
| 45 | + |
| 46 | +link_directories(lib/) |
| 47 | +include_directories(lib/include/) |
| 48 | +include_directories(include/) |
| 49 | + |
| 50 | +add_subdirectory(src/) |
| 51 | + |
| 52 | +if(NOT TARGET uninstall) |
| 53 | + configure_file( |
| 54 | + "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake" |
| 55 | + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" |
| 56 | + IMMEDIATE @ONLY) |
| 57 | + |
| 58 | + add_custom_target(uninstall |
| 59 | + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) |
| 60 | +endif() |
0 commit comments