From f8c25e333d2ae7d12637d525857ebd58f238a991 Mon Sep 17 00:00:00 2001 From: "AD001\\z0038f3t" Date: Wed, 4 Jun 2025 12:12:25 +0530 Subject: [PATCH] refactor: cmake to use macro for target definitions --- array/profile/CMakeLists.txt | 17 ++--------------- maps/profile/CMakeLists.txt | 7 +------ smart_ptr/profile/CMakeLists.txt | 19 ++----------------- string/custom/CMakeLists.txt | 9 +-------- threads/profile/main.cpp | 4 ---- vectors/profile/CMakeLists.txt | 6 +----- 6 files changed, 7 insertions(+), 55 deletions(-) diff --git a/array/profile/CMakeLists.txt b/array/profile/CMakeLists.txt index e930716..a495a97 100644 --- a/array/profile/CMakeLists.txt +++ b/array/profile/CMakeLists.txt @@ -1,15 +1,2 @@ -add_executable(array array-main.cpp) -target_compile_options(array PRIVATE -Os -fno-rtti -fno-exceptions) -enable_map_file_for_target(array) -add_test( NAME array - COMMAND $) - - -add_executable(stdarray stdarray-main.cpp) -target_compile_options(stdarray PRIVATE -Os -fno-rtti -fno-exceptions) -enable_map_file_for_target(stdarray) -add_test( NAME stdarray - COMMAND $) - -print_size(array) -print_size(stdarray) +configure_target(array array-main.cpp) +configure_target(stdarray stdarray-main.cpp) diff --git a/maps/profile/CMakeLists.txt b/maps/profile/CMakeLists.txt index ac10267..9ee18a6 100644 --- a/maps/profile/CMakeLists.txt +++ b/maps/profile/CMakeLists.txt @@ -1,6 +1 @@ - -add_executable(profile_map main.cpp) -enable_map_file_for_target(profile_map) - -add_test( NAME profile_map - COMMAND $) \ No newline at end of file +configure_target(profile_map main.cpp) \ No newline at end of file diff --git a/smart_ptr/profile/CMakeLists.txt b/smart_ptr/profile/CMakeLists.txt index 9868fc7..cfe08d7 100644 --- a/smart_ptr/profile/CMakeLists.txt +++ b/smart_ptr/profile/CMakeLists.txt @@ -1,17 +1,2 @@ -add_executable(rawptr rawptr-main.cpp) -target_compile_options(rawptr PRIVATE -Os -fno-rtti -fno-exceptions) - -enable_map_file_for_target(rawptr) -add_test( NAME rawptr - COMMAND $) - - -add_executable(uniqueptr uniqueptr-main.cpp) -target_compile_options(uniqueptr PRIVATE -Os -fno-rtti -fno-exceptions) -enable_map_file_for_target(uniqueptr) - -add_test( NAME uniqueptr - COMMAND $) - -print_size(rawptr) -print_size(uniqueptr) +configure_target(rawptr rawptr-main.cpp) +configure_target(uniqueptr uniqueptr-main.cpp) \ No newline at end of file diff --git a/string/custom/CMakeLists.txt b/string/custom/CMakeLists.txt index 220924a..d705261 100644 --- a/string/custom/CMakeLists.txt +++ b/string/custom/CMakeLists.txt @@ -1,8 +1 @@ -add_executable(string string-main.cpp) -target_compile_options(string PRIVATE -Os -fno-rtti -fno-exceptions) -enable_map_file_for_target(string) - -add_test( NAME string - COMMAND $) - -print_size(string) +configure_target(string string-main.cpp) diff --git a/threads/profile/main.cpp b/threads/profile/main.cpp index 9acaafd..2ac04fd 100644 --- a/threads/profile/main.cpp +++ b/threads/profile/main.cpp @@ -1,7 +1,3 @@ -// We want the full POSIX and C99 standard -#define _GNU_SOURCE - -// Standard UNIX includes #include #include #include diff --git a/vectors/profile/CMakeLists.txt b/vectors/profile/CMakeLists.txt index f088554..de47031 100644 --- a/vectors/profile/CMakeLists.txt +++ b/vectors/profile/CMakeLists.txt @@ -1,5 +1 @@ -add_executable(profile_vector main.cpp) -enable_map_file_for_target(profile_vector) - -add_test( NAME profile_vector - COMMAND $) \ No newline at end of file +configure_target(profile_vector main.cpp)