aklomp / base64

Fast Base64 stream encoder/decoder in C99, with SIMD acceleration
BSD 2-Clause "Simplified" License
866 stars 162 forks source link

cmake: generate only plain codecs #93

Closed htot closed 2 years ago

htot commented 2 years ago

When I'm not using cmake-gui (i.e. generating using Yocto) only the plain codec is built in some cases. I don't understand why, but the below patch seems to resolve it. As if the string was never evaluated. Any ideas? @BurningEnlightenment @aklomp

 add_feature_info("OpenMP codec" BASE64_WITH_OpenMP "spreads codec work accross multiple threads")
 cmake_dependent_option(BASE64_REGENERATE_TABLES "regenerate the codec tables" OFF "NOT CMAKE_CROSSCOMPILING" OFF)

-set(_IS_X86 "_TARGET_ARCH STREQUAL \"x86\" OR _TARGET_ARCH STREQUAL \"x64\"")
+if((_TARGET_ARCH STREQUAL "x86") OR (_TARGET_ARCH STREQUAL "x64"))
+    set(_IS_X86 1)
+else()
+    set(_IS_X86 0)
+endif()
 cmake_dependent_option(BASE64_WITH_SSSE3 "add SSSE 3 codepath" ON ${_IS_X86} OFF)
 add_feature_info(SSSE3 BASE64_WITH_SSSE3 "add SSSE 3 codepath")
 cmake_dependent_option(BASE64_WITH_SSE41 "add SSE 4.1 codepath" ON ${_IS_X86} OFF)