Something sideways in our CmakeFileList.txt file . He is trying to create an IA32 component on the ARM platform. I am trying to solve a problem.
This file has been filtered from GLOB called rdrand.cpp :
list(REMOVE_ITEM cryptopp_SOURCES ... ${CMAKE_CURRENT_SOURCE_DIR}/rdrand.cpp ... ${cryptopp_SOURCES_TEST} ) set(cryptopp_SOURCES
Now I'm trying to add rdrand,cpp back for IA32 platforms. According to Building a C ++ project on Windows using CMake, Clang and Ninja (not very suitable, but has useful information) and CMakePlatformId.h.in , it looks like I need a predicate using ARCHITECTURE_ID and "X86" , "X32" , "X64" or "X64" (not dup, x lowercase instead of uppercase).
Here is my attempt to create a predicate:
# http://github.com/weidai11/cryptopp/issues/419 if (${ARCHITECTURE_ID} == "X86" OR ${ARCHITECTURE_ID} == "X32" OR ${ARCHITECTURE_ID} == "X64" ) list(APPEND cryptopp_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/rdrand.cpp) endif()
Below are the results with BeagleBoard with Cmake 3.5.2. Neither == , = , STREQUAL does not work:
CMake Error at CMakeLists.txt:310 (if): if given arguments: "==" "X86" "OR" "==" "X32" "OR" "==" "X64" Unknown arguments specified
and
$ cmake . CMake Error at CMakeLists.txt:310 (if): if given arguments: "STREQUAL" "X86" "OR" "STREQUAL" "X32" "OR" "STREQUAL" "X64" Unknown arguments specified
My attempts to find a way to use ARCHITECTURE_ID almost useless. I cannot find an example or documents on the Cmake website . Adding quotes around "${ARCHITECTURE_ID}" did not help; also did not remove curly braces to indicate the variable ARCHITECTURE_ID .
I also tried using CMAKE_SYSTEM_PROCESSOR and other related definitions, but Cmake basically returns "unknown" for them. This is not very useful, to say the least.
How to use ARCHITECTURE_ID to identify IA32 platforms? Or is there anything else I should use in this case?
Thanks in advance.
Here's what we do in our GNUmakefile . Make is not an assembly, so we must do a heavy lift:
IS_X86 := $(shell uname -m | $(EGREP) -v "x86_64" | $(EGREP) -i -c "i.86|x86|i86") IS_X64 := $(shell uname -m | $(EGREP) -i -c "(_64|d64)") ... # Need RDRAND for X86/X64/X32 ifeq ($(IS_X86)$(IS_X32)$(IS_X64),000) SRCS := $(filter-out rdrand.cpp, $(SRCS)) endif