Skip to content

Commit eaa9053

Browse files
committed
Fix try_compile usage
1 parent 2c04af8 commit eaa9053

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ if (NOT DEFINED CMAKE_C_STANDARD)
166166
RESULT
167167
${AWSLC_BINARY_DIR}
168168
SOURCES "${CMAKE_CURRENT_LIST_DIR}/tests/compiler_features_tests/c11.c"
169-
COMPILE_DEFINITIONS -c -std=c11)
169+
CMAKE_FLAGS "-DCMAKE_C_FLAGS=-c -std=c11")
170170
if(RESULT)
171171
set(CMAKE_C_STANDARD 11)
172172
else()
@@ -344,7 +344,7 @@ macro(check_compiler file_to_test flag_to_set)
344344
${flag_to_set} # Use CMake variable of the same name as the C flag to allow later reference
345345
${AWSLC_BINARY_DIR}
346346
SOURCES "${AWSLC_SOURCE_DIR}/tests/compiler_features_tests/${file_to_test}"
347-
COMPILE_DEFINITIONS "-Werror ${ARGN}"
347+
CMAKE_FLAGS "-DCMAKE_C_FLAGS=-Werror ${ARGN}" "-DCMAKE_CXX_FLAGS=-Werror ${ARGN}"
348348
OUTPUT_VARIABLE ERROR_MESSAGE)
349349
if(${flag_to_set})
350350
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D${flag_to_set}")
@@ -371,7 +371,7 @@ macro(check_run file_to_test flag_to_set compile_flags)
371371
COMPILE_RESULT
372372
"${CMAKE_CURRENT_BINARY_DIR}"
373373
"${CMAKE_CURRENT_LIST_DIR}/tests/compiler_features_tests/${file_to_test}"
374-
COMPILE_DEFINITIONS "${compile_flags}"
374+
CMAKE_FLAGS "-DCMAKE_C_FLAGS=${compile_flags}" "-DCMAKE_CXX_FLAGS=${compile_flags}"
375375
OUTPUT_VARIABLE COMPILE_AND_RUN_OUTPUT)
376376
if (NOT COMPILE_RESULT)
377377
message(WARNING "COMPILE_AND_RUN_OUTPUT ${COMPILE_AND_RUN_OUTPUT}")

0 commit comments

Comments
 (0)