Skip to content

Commit

Permalink
cmake: modernize cmake code in tests folder
Browse files Browse the repository at this point in the history
  • Loading branch information
oltolm committed Apr 24, 2023
1 parent fc05121 commit b4a10b3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
22 changes: 19 additions & 3 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
force_debug ()


#
# test_mgwhelp
#
Expand All @@ -16,6 +15,7 @@ add_test (
NAME test_mgwhelp
COMMAND test_mgwhelp
)
set_tests_properties(test_mgwhelp PROPERTIES FIXTURES_REQUIRED test_fixture)

#
# test_mgwhelp_split
Expand Down Expand Up @@ -47,6 +47,7 @@ add_test (
NAME test_mgwhelp_split
COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_mgwhelp_split.exe
)
set_tests_properties(test_mgwhelp_split PROPERTIES FIXTURES_REQUIRED test_fixture)


#
Expand Down Expand Up @@ -82,7 +83,7 @@ add_test (
NAME test_mgwhelp_split_subdir
COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_mgwhelp_split_subdir.exe
)

set_tests_properties(test_mgwhelp_split_subdir PROPERTIES FIXTURES_REQUIRED test_fixture)

#
# test_mgwhelp_stripped
Expand All @@ -105,13 +106,13 @@ add_test (
NAME test_mgwhelp_stripped
COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_mgwhelp_stripped.exe
)
set_tests_properties(test_mgwhelp_stripped PROPERTIES FIXTURES_REQUIRED test_fixture)


#
# test_mgwhelp_zdebug
#

option (ENABLE_ZDEBUG_TEST "Enable compressed debug sections test." OFF)
add_custom_command (
OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_mgwhelp_zdebug.debug
COMMAND ${CMAKE_OBJCOPY} --only-keep-debug --compress-debug-sections $<TARGET_FILE:test_mgwhelp> ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_mgwhelp_zdebug.debug
Expand Down Expand Up @@ -181,6 +182,7 @@ endif ()
if (OBJCOPY_VERSION STREQUAL "llvm-objcopy")
set_target_properties (test_mgwhelp_zdebug PROPERTIES EXCLUDE_FROM_ALL ON)
else ()
set_tests_properties(test_mgwhelp_zdebug PROPERTIES FIXTURES_REQUIRED test_fixture)
endif ()
if (OBJCOPY_VERSION STREQUAL "llvm-objcopy" OR OBJCOPY_VERSION VERSION_LESS "2.34")
set_tests_properties (test_mgwhelp_zdebug PROPERTIES DISABLED ON)
Expand All @@ -203,6 +205,7 @@ add_test (
COMMAND test_exchndl_static_unicode
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
)
set_tests_properties(test_exchndl_static_unicode PROPERTIES FIXTURES_REQUIRED test_fixture)


#
Expand All @@ -221,6 +224,7 @@ add_test (
COMMAND test_exchndl_static_ansi
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
)
set_tests_properties(test_exchndl_static_ansi PROPERTIES FIXTURES_REQUIRED test_fixture)


#
Expand All @@ -239,6 +243,7 @@ add_test (
COMMAND test_exchndl_dynamic_unicode
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
)
set_tests_properties(test_exchndl_dynamic_unicode PROPERTIES FIXTURES_REQUIRED test_fixture)


#
Expand All @@ -257,6 +262,7 @@ add_test (
COMMAND test_exchndl_dynamic_ansi
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
)
set_tests_properties(test_exchndl_dynamic_ansi PROPERTIES FIXTURES_REQUIRED test_fixture)


#
Expand All @@ -271,3 +277,13 @@ add_test (
COMMAND test_addr2line
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
)
set_tests_properties(test_addr2line PROPERTIES FIXTURES_REQUIRED test_fixture)

add_test(test_build
"${CMAKE_COMMAND}"
--build "${CMAKE_BINARY_DIR}"
--config "$<CONFIG>"
--target all
)

set_tests_properties(test_build PROPERTIES FIXTURES_SETUP test_fixture)
6 changes: 6 additions & 0 deletions tests/apps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ if (MINGW)
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer")
set (CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -fno-omit-frame-pointer")
set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -fno-omit-frame-pointer")

add_link_options(
-static
-static-libgcc
-static-libstdc++
)
endif ()

# https://github.com/jrfonseca/drmingw/issues/42
Expand Down

0 comments on commit b4a10b3

Please sign in to comment.