cmake 不能让CLion实际使用GCC编译器而不是Clang?

6za6bjd0  于 2023-04-30  发布在  其他
关注(0)|答案(1)|浏览(171)

我已经尝试按照所有的帮助更改我的编译器使用GCC而不是Clang(在macOS上),因为我想尝试使用__gnu_pbds::priority_queue而不是STL版本,而且似乎CMake仍然使用Clang。我做了一个工具链,看起来像这样:

并将其设置为在CMake配置文件中使用。

然而,CMake似乎跳过了实际使用编译器-这里是CMake输出:

/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ -G "CodeBlocks - Unix Makefiles" -S /Users/steve/CLionProjects/TestModernTimeStretch -B /Users/steve/CLionProjects/TestModernTimeStretch/cmake-build-release-gcc
-- The C compiler identification is AppleClang 13.1.6.13160021
-- The CXX compiler identification is AppleClang 13.1.6.13160021
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for stdbool.h
-- Looking for stdbool.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Checking processor clipping capabilities...
-- Performing Test CPU_CLIPS_POSITIVE
-- Performing Test CPU_CLIPS_POSITIVE - Failed
-- Performing Test CPU_CLIPS_NEGATIVE
-- Performing Test CPU_CLIPS_NEGATIVE - Failed
-- Checking processor clipping capabilities... none
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/steve/CLionProjects/TestModernTimeStretch/cmake-build-release-gcc
lmyy7pcs

lmyy7pcs1#

看起来您配置的是/usr/bin/g++(这是Apple对Clang++的软链接别名),而不是/usr/local/Cellar/gcc/11.3.0_1/bin/g++-11

  • (注:这是@Eljay对OP的问题的评论,这是正确的答案-张贴在这里作为答案,以便它可以被标记为这样)*

相关问题