Skip to content

Commit 842852d

Browse files
authored
Merge pull request #675 from fuzzard/fix_win-x64_detection
[cmake] Fix win x64 and arm64 detection in cmake
2 parents 5e46957 + fcd6a21 commit 842852d

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

src/cec-client/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ if (NOT WIN32)
6666
endif()
6767
else()
6868
add_definitions(-DTARGET_WINDOWS -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -D_WINSOCKAPI_)
69-
if ((${WIN64}) OR (${_M_ARM64}))
69+
check_symbol_exists(_AMD64_ Windows.h WIN64)
70+
check_symbol_exists(_ARM64_ Windows.h ARM64)
71+
if (WIN64 OR ARM64)
7072
string(REPLACE "/arch:SSE2" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
7173
else()
7274
add_definitions(-D_USE_32BIT_TIME_T)

src/cecc-client/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ if (NOT WIN32)
3636
endif()
3737
else()
3838
add_definitions(-DTARGET_WINDOWS -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -D_WINSOCKAPI_)
39-
if ((${WIN64}) OR (${_M_ARM64}))
39+
check_symbol_exists(_AMD64_ Windows.h WIN64)
40+
check_symbol_exists(_ARM64_ Windows.h ARM64)
41+
if (WIN64 OR ARM64)
4042
string(REPLACE "/arch:SSE2" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
4143
else()
4244
add_definitions(-D_USE_32BIT_TIME_T)

src/libcec/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ if (WIN32)
161161
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libcec.rc.in ${CMAKE_CURRENT_SOURCE_DIR}/libcec.rc)
162162
add_definitions(-DDLL_EXPORT)
163163
add_definitions(-DTARGET_WINDOWS -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -D_WINSOCKAPI_)
164-
if ((${WIN64}) OR (${_M_ARM64}))
164+
if (WIN64 OR ARM64)
165165
string(REPLACE "/arch:SSE2" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
166166
else()
167167
add_definitions(-D_USE_32BIT_TIME_T)

src/libcec/cmake/CheckPlatformSupport.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ if(WIN32)
5050
# force python2 for eventghost
5151
set(PYTHON_USE_VERSION 2)
5252
elseif("${MSVC_C_ARCHITECTURE_ID}" STREQUAL "x64")
53-
check_symbol_exists(_X64_ Windows.h WIN64)
54-
check_symbol_exists(_AMD64_ Windows.h AMD64)
55-
if (DEFINED WIN64 OR DEFINED AMD64)
53+
check_symbol_exists(_AMD64_ Windows.h WIN64)
54+
if (DEFINED WIN64)
5655
set(LIB_INFO "${LIB_INFO} (x64)")
5756
endif()
5857
elseif("${MSVC_C_ARCHITECTURE_ID}" STREQUAL "ARM")
5958
set(LIB_INFO "${LIB_INFO} (arm)")
6059
elseif("${MSVC_C_ARCHITECTURE_ID}" STREQUAL "ARM64")
60+
check_symbol_exists(_ARM64_ Windows.h ARM64)
6161
set(LIB_INFO "${LIB_INFO} (arm64)")
6262
else()
6363
message(FATAL_ERROR "Unknown architecture id: ${MSVC_C_ARCHITECTURE_ID}")

0 commit comments

Comments
 (0)