|
1 | 1 | # |
2 | | -# Copyright 2017, Intel Corporation |
| 2 | +# Copyright 2017-2020, Intel Corporation |
3 | 3 | # |
4 | 4 | # Redistribution and use in source and binary forms, with or without |
5 | 5 | # modification, are permitted provided that the following conditions |
|
30 | 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
31 | 31 |
|
32 | 32 | cmake_minimum_required(VERSION 3.3) |
33 | | -project(syscall_intercept C CXX ASM) |
| 33 | +project(syscall_intercept C ASM) |
34 | 34 |
|
35 | 35 | set(CMAKE_DISABLE_IN_SOURCE_BUILD ON) |
36 | 36 | # Setting CMAKE_DISABLE_IN_SOURCE_BUILD to ON should |
@@ -63,6 +63,7 @@ set(SYSCALL_INTERCEPT_VERSION |
63 | 63 | include(cmake/find_capstone.cmake) |
64 | 64 | include(GNUInstallDirs) |
65 | 65 | include(cmake/toolchain_features.cmake) |
| 66 | +include(CheckLanguage) |
66 | 67 |
|
67 | 68 | # main source files - intentionally excluding src/cmdline_filter.c |
68 | 69 | set(SOURCES_C |
@@ -147,15 +148,18 @@ set_target_properties(syscall_intercept_shared |
147 | 148 | PROPERTIES VERSION ${SYSCALL_INTERCEPT_VERSION} |
148 | 149 | SOVERSION ${SYSCALL_INTERCEPT_VERSION_MAJOR}) |
149 | 150 |
|
150 | | -add_executable(cpp_test src/cpp_compile_test.cc src/cpp_compile_mock.c) |
151 | | - |
152 | 151 | set_target_properties(syscall_intercept_shared syscall_intercept_static |
153 | 152 | PROPERTIES |
154 | 153 | LINKER_LANGUAGE C |
155 | 154 | PUBLIC_HEADER "include/libsyscall_intercept_hook_point.h" |
156 | 155 | OUTPUT_NAME syscall_intercept) |
157 | 156 |
|
158 | | -add_dependencies(syscall_intercept_base_c cpp_test) |
| 157 | +check_language(CXX) |
| 158 | +if(CMAKE_CXX_COMPILER) |
| 159 | + enable_language(CXX) |
| 160 | + add_executable(cpp_test src/cpp_compile_test.cc src/cpp_compile_mock.c) |
| 161 | + add_dependencies(syscall_intercept_base_c cpp_test) |
| 162 | +endif() |
159 | 163 |
|
160 | 164 | if(PERFORM_STYLE_CHECKS) |
161 | 165 | include(FindPerl) |
|
0 commit comments