Android: CMake 3.15 internal interfaces not supported by NDK r19 toolchain file
In 3.14.6 of CMake, this code worked:
# at the top level of the project somewhere
set( ZIOSK_CXX_STANDARD 17 )
# Later on after we define a library target
if( ZIOSK_CXX_STANDARD )
set_target_properties( ${target_name} PROPERTIES
CXX_STANDARD ${ZIOSK_CXX_STANDARD}
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
)
endif()
However, after upgrading to CMake 3.15, the -std=c++17
flag is not passed to Clang (I'm using Android NDK r19c).
Here is the configuration of a translation unit in my build.ninja
on 3.15:
build ZPayService/Interface/CMakeFiles/ZPayServiceInterface.dir/Source/ZPay/Protocol/Kizi.cpp.o: CXX_COMPILER__ZPayServiceInterface ../../../../Interface/Source/ZPay/Protocol/Kizi.cpp || cmake_object_order_depends_target_ZPayServiceInterface
DEFINES = -DANDROID -DBETTER_ENUMS_STRICT_CONVERSION -DBOOST_ALL_NO_LIB -DBOOST_BIND_NO_PLACEHOLDERS -DBOOST_FILESYSTEM_NO_DEPRECATED -DBOOST_NO_CXX11_ALLOCATOR -DBOOST_UUID_RANDOM_PROVIDER_FORCE_POSIX -DCEREAL_RAPIDJSON_NAMESPACE=cereal_rapidjson -DDEBUG=1 -DZIOSK_ENABLE_DEVELOPER_LOGS -DZIOSK_MODULE_NAME=\"ZPayServiceInterface\" -D_SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING -D_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING
DEP_FILE = ZPayService\Interface\CMakeFiles\ZPayServiceInterface.dir\Source\ZPay\Protocol\Kizi.cpp.o.d
FLAGS = -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mfpu=vfpv3-d16 -fno-addrsig -march=armv7-a -mthumb -Wa,--noexecstack -Wformat -Werror=format-security -stdlib=libc++ -Qunused-arguments -O0 -fno-limit-debug-info -fPIC -Wno-inconsistent-missing-override -Werror
INCLUDES = -I../../../../Interface/Source -I../../../../../Core/UI/Source -ICore/UI/Source -I../../../../../Core/External/PowerVR/source/framework/PVRUtils/.. -I../../../../../Core/External/PowerVR/source/cmake/../include -I../../../../../Core/External/PowerVR/source/framework/PVRAssets/.. -I../../../../../Core/External/PowerVR/source/framework/PVRCore/.. -I../../../../../Core/External/PowerVR/source/external/pugixml/. -I../../../../../Core/External/openssl/android/include -I../../../../../Core/External/sqlite/. -I../../../../../Core/External/cereal/cereal/include -I../../../../../Core/External/cereal/cereal_optional_nvp/include -I../../../../../Core/External/rapidxml/include -I../../../../../Core/External/better-enums/include -I../../../../../Core/External/libpng/include -I../../../../../Core/External/duktape/src -I../../../../../Core/External/uri/source/include -I../../../../../Core/External/fmt/include -I../../../../../Core/External/stb_image/include -I../../../../../Core/External/ms_tts/include -I../../../../../Core/MsrInterface/Source -I../../../../../Core/External/bsp/msr/include -IC:/android/android-ndk-r19c/sources/android/cpufeatures -IC:/android/android-ndk-r19c/sources/android/native_app_glue -I../../../../../Core/External/bsp/zpaylib/include -I../../../../ZPayUtilities/Source -I../../../../../Core/ServiceInterfaces/PaymentServiceInterface/Source -I../../../../../Core/Wallet/Source -I../../../../../Core/External/json/include -isystem ../../../../../Core/External/boost/include -isystem ../../../../../Core/External/openssl/include
OBJECT_DIR = ZPayService\Interface\CMakeFiles\ZPayServiceInterface.dir
OBJECT_FILE_DIR = ZPayService\Interface\CMakeFiles\ZPayServiceInterface.dir\Source\ZPay\Protocol
And here is the same one using 3.14.6:
build ZPayService/Interface/CMakeFiles/ZPayServiceInterface.dir/Source/ZPay/Protocol/Kizi.cpp.o: CXX_COMPILER__ZPayServiceInterface ../../../../Interface/Source/ZPay/Protocol/Kizi.cpp || cmake_object_order_depends_target_ZPayServiceInterface
DEFINES = -DANDROID -DBETTER_ENUMS_STRICT_CONVERSION -DBOOST_ALL_NO_LIB -DBOOST_BIND_NO_PLACEHOLDERS -DBOOST_FILESYSTEM_NO_DEPRECATED -DBOOST_NO_CXX11_ALLOCATOR -DBOOST_UUID_RANDOM_PROVIDER_FORCE_POSIX -DCEREAL_RAPIDJSON_NAMESPACE=cereal_rapidjson -DDEBUG=1 -DZIOSK_ENABLE_DEVELOPER_LOGS -DZIOSK_MODULE_NAME=\"ZPayServiceInterface\" -D_SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING -D_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING
DEP_FILE = ZPayService\Interface\CMakeFiles\ZPayServiceInterface.dir\Source\ZPay\Protocol\Kizi.cpp.o.d
FLAGS = -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mfpu=vfpv3-d16 -fno-addrsig -march=armv7-a -mthumb -Wa,--noexecstack -Wformat -Werror=format-security -stdlib=libc++ -Qunused-arguments -O0 -fno-limit-debug-info -fPIC -Wno-inconsistent-missing-override -Werror -std=c++17
INCLUDES = -I../../../../Interface/Source -I../../../../../Core/UI/Source -ICore/UI/Source -I../../../../../Core/External/PowerVR/source/framework/PVRUtils/.. -I../../../../../Core/External/PowerVR/source/cmake/../include -I../../../../../Core/External/PowerVR/source/framework/PVRAssets/.. -I../../../../../Core/External/PowerVR/source/framework/PVRCore/.. -I../../../../../Core/External/PowerVR/source/external/pugixml/. -I../../../../../Core/External/openssl/android/include -I../../../../../Core/External/sqlite/. -I../../../../../Core/External/cereal/cereal/include -I../../../../../Core/External/cereal/cereal_optional_nvp/include -I../../../../../Core/External/rapidxml/include -I../../../../../Core/External/better-enums/include -I../../../../../Core/External/libpng/include -I../../../../../Core/External/duktape/src -I../../../../../Core/External/uri/source/include -I../../../../../Core/External/fmt/include -I../../../../../Core/External/stb_image/include -I../../../../../Core/External/ms_tts/include -I../../../../../Core/MsrInterface/Source -I../../../../../Core/External/bsp/msr/include -IC:/android/android-ndk-r19c/sources/android/cpufeatures -IC:/android/android-ndk-r19c/sources/android/native_app_glue -I../../../../../Core/External/bsp/zpaylib/include -I../../../../ZPayUtilities/Source -I../../../../../Core/ServiceInterfaces/PaymentServiceInterface/Source -I../../../../../Core/Wallet/Source -I../../../../../Core/External/json/include -isystem ../../../../../Core/External/boost/include -isystem ../../../../../Core/External/openssl/include
OBJECT_DIR = ZPayService\Interface\CMakeFiles\ZPayServiceInterface.dir
OBJECT_FILE_DIR = ZPayService\Interface\CMakeFiles\ZPayServiceInterface.dir\Source\ZPay\Protocol
Notice that the FLAGS
list is missing -std=c++17
in 3.15 but is present in 3.14.6.
I also tried switching my code to this but it didn't make a different in 3.15:
if( ZIOSK_CXX_STANDARD )
target_compile_features( ${target_name} PUBLIC cxx_std_${ZIOSK_CXX_STANDARD} )
set_target_properties( ${target_name} PROPERTIES
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
)
endif()