Skip to content

Commit 530f409

Browse files
committed
Fix try_compile usage
1 parent 76bf725 commit 530f409

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
@@ -175,7 +175,7 @@ if (NOT DEFINED CMAKE_C_STANDARD)
175175
RESULT
176176
${AWSLC_BINARY_DIR}
177177
SOURCES "${CMAKE_CURRENT_LIST_DIR}/tests/compiler_features_tests/c11.c"
178-
COMPILE_DEFINITIONS -c -std=c11)
178+
CMAKE_FLAGS "-DCMAKE_C_FLAGS=-c -std=c11")
179179
if(RESULT)
180180
set(CMAKE_C_STANDARD 11)
181181
else()
@@ -353,7 +353,7 @@ macro(check_compiler file_to_test flag_to_set)
353353
${flag_to_set} # Use CMake variable of the same name as the C flag to allow later reference
354354
${AWSLC_BINARY_DIR}
355355
SOURCES "${AWSLC_SOURCE_DIR}/tests/compiler_features_tests/${file_to_test}"
356-
COMPILE_DEFINITIONS "-Werror ${ARGN}"
356+
CMAKE_FLAGS "-DCMAKE_C_FLAGS=-Werror ${ARGN}" "-DCMAKE_CXX_FLAGS=-Werror ${ARGN}"
357357
OUTPUT_VARIABLE ERROR_MESSAGE)
358358
if(${flag_to_set})
359359
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D${flag_to_set}")
@@ -380,7 +380,7 @@ macro(check_run file_to_test flag_to_set compile_flags)
380380
COMPILE_RESULT
381381
"${CMAKE_CURRENT_BINARY_DIR}"
382382
"${CMAKE_CURRENT_LIST_DIR}/tests/compiler_features_tests/${file_to_test}"
383-
COMPILE_DEFINITIONS "${compile_flags}"
383+
CMAKE_FLAGS "-DCMAKE_C_FLAGS=${compile_flags}" "-DCMAKE_CXX_FLAGS=${compile_flags}"
384384
OUTPUT_VARIABLE COMPILE_AND_RUN_OUTPUT)
385385
if (NOT COMPILE_RESULT)
386386
message(WARNING "COMPILE_AND_RUN_OUTPUT ${COMPILE_AND_RUN_OUTPUT}")

0 commit comments

Comments
 (0)