在 CMakeLists.txt中project之前加入
set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
参考: gcc - CMake: The C Compiler is not able to compile a simple test program - Stack Overflow