sakra / cotire

CMake module to speed up builds.
MIT License
1.3k stars 143 forks source link

Cotire 1.7.10 fails to generate precompiled headers on Android with CMake 3.10 on Windows #146

Open MaxSavenkov opened 6 years ago

MaxSavenkov commented 6 years ago

Trying to generate a precompiled header results in error:

clang++.exe: warning: argument unused during compilation: '-mthumb'
clang++.exe: warning: argument unused during compilation: '-mfpu=vfpv3-d16'
clang++.exe: warning: argument unused during compilation: '-mfloat-abi=softfp'
error: unknown target CPU 'armv7-a'

Log file: log.txt

At the same time, if precompiled header generation is removed, the code is compiled without any problems, so the CMakeLists itself works. It seems that Cotire(?) fails to forward some flags to clang (in particular, --target with triplet seem to be missing from the clang++ invocation, see log).

Example project is attached. See configure_ndr.cmd for the set of CMake options, change the path to Android NDK (CMAKE_ANDROID_NDK) in configure_ndr.cmd to your own to make it work.

cotire_test.zip

In-line commented 6 years ago

Same issue

robneval commented 5 years ago

Same issue. I disabled the precompiled header for the target to workaround this. set_target_properties("${target}" PROPERTIES COTIRE_ENABLE_PRECOMPILED_HEADER FALSE)

Zaffy commented 5 years ago

I ran into the same issue, If you don't want to modify (fix) cotire, just pass the target to compiler and linker manually.

Example:


set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fshort-wchar --target=${CMAKE_CXX_COMPILER_TARGET}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fshort-wchar --target=${CMAKE_C_COMPILER_TARGET}")

set(CMAKE_EXE_LINKER_FLAGS  "${CMAKE_EXE_LINKER_FLAGS} --target=${CMAKE_CXX_COMPILER_TARGET}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --target=${CMAKE_C_COMPILER_TARGET}")
robneval commented 5 years ago

@Zaffy that made the unknown target disappear. But for me when compiling cotired files Android NDK headers are not found. No problems when i disable precompiled headers.