cmake_minimum_required(VERSION 2.8.12) add_subdirectory(system) # tests INCLUDE(FindPkgConfig) set(CMAKE_C_FLAGS_DEFAULT ${CMAKE_C_FLAGS}) set(CMAKE_C_FLAGS "") set(CMAKE_C_FLAGS_CUSTOM "-g -O0 -fno-omit-frame-pointer -funwind-tables") if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "armv7l") set(CMAKE_C_FLAGS_CUSTOM "${CMAKE_C_FLAGS_CUSTOM} -marm") endif () set(test1_suffixes sleep crash ill) foreach(suffix ${test1_suffixes}) add_executable(test1-default-${suffix} test1.c) set(DEFAULT_FLAGS_TARGETS test1-default-${suffix}) add_executable(test1-custom-${suffix} test1.c) set(CUSTOM_FLAGS_TARGETS test1-custom-${suffix}) endforeach() pkg_check_modules (GLIB2 glib-2.0) configure_file(test2.c test2-custom.c COPYONLY) add_executable(test2-custom test2-custom.c) target_include_directories(test2-custom SYSTEM PUBLIC ${GLIB2_INCLUDE_DIRS}) target_link_libraries(test2-custom ${GLIB2_LDFLAGS}) list(APPEND CUSTOM_FLAGS_TARGETS test2-custom) add_executable(test3-custom test3.c) target_include_directories(test3-custom SYSTEM PUBLIC ${GLIB2_INCLUDE_DIRS}) target_link_libraries(test3-custom ${GLIB2_LDFLAGS} -lpthread) list(APPEND CUSTOM_FLAGS_TARGETS test3-custom) set_target_properties(${CUSTOM_FLAGS_TARGETS} PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS_CUSTOM}") set_target_properties(${DEFAULT_FLAGS_TARGETS} PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS_DEFAULT}") configure_file(run_tests.sh.in run_tests.sh @ONLY) configure_file(tests_common.sh.in tests_common.sh @ONLY) configure_file(crash_common.sh.in crash_common.sh @ONLY) # Installing foreach(suffix ${test1_suffixes}) install(TARGETS test1-default-${suffix} test1-custom-${suffix} DESTINATION ${CRASH_TESTS_PATH}) endforeach() install(FILES run_tests.sh tests_common.sh crash_common.sh DESTINATION ${CRASH_TESTS_PATH} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)