Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/159.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
CMake C++;编译命令 我目前正在学习CGUD,我理解它是一个构建文件生成器,我想看看CMake运行的命令,编译并链接我的C++文件。例如,如果我使用一个文件main.cpp,并且要用gcc编译它,我会运行gcc-o main.cpp。我如何看到CMake正在运行的C++命令?我尝试了使VBOSE = 1 但这只显示了CuScript相关命令而不是C++编译器命令。 // main.cpp #include <iostream> int main() { std::cout << "Hello world" << std::endl; } //CMakeLists.txt cmake_minimum_required(VERSION 3.2) project(example LANGUAGES CXX) add_executable(main main.cpp)_C++_Cmake - Fatal编程技术网

CMake C++;编译命令 我目前正在学习CGUD,我理解它是一个构建文件生成器,我想看看CMake运行的命令,编译并链接我的C++文件。例如,如果我使用一个文件main.cpp,并且要用gcc编译它,我会运行gcc-o main.cpp。我如何看到CMake正在运行的C++命令?我尝试了使VBOSE = 1 但这只显示了CuScript相关命令而不是C++编译器命令。 // main.cpp #include <iostream> int main() { std::cout << "Hello world" << std::endl; } //CMakeLists.txt cmake_minimum_required(VERSION 3.2) project(example LANGUAGES CXX) add_executable(main main.cpp)

CMake C++;编译命令 我目前正在学习CGUD,我理解它是一个构建文件生成器,我想看看CMake运行的命令,编译并链接我的C++文件。例如,如果我使用一个文件main.cpp,并且要用gcc编译它,我会运行gcc-o main.cpp。我如何看到CMake正在运行的C++命令?我尝试了使VBOSE = 1 但这只显示了CuScript相关命令而不是C++编译器命令。 // main.cpp #include <iostream> int main() { std::cout << "Hello world" << std::endl; } //CMakeLists.txt cmake_minimum_required(VERSION 3.2) project(example LANGUAGES CXX) add_executable(main main.cpp),c++,cmake,C++,Cmake,make VERBOSE=1返回: /usr/local/Cellar/cmake/3.14.5/bin/cmake -S/Users/.../Desktop/cpp -B/Users/.../Desktop/cpp/build --check-build-system CMakeFiles/Makefile.cmake 0 /usr/local/Cellar/cmake/3.14.5/bin/cmake -E cmake_progress_start /Users/.../Desktop/cp

make VERBOSE=1
返回:

/usr/local/Cellar/cmake/3.14.5/bin/cmake -S/Users/.../Desktop/cpp -B/Users/.../Desktop/cpp/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/Cellar/cmake/3.14.5/bin/cmake -E cmake_progress_start /Users/.../Desktop/cpp/build/CMakeFiles /Users/.../Desktop/cpp/build/CMakeFiles/progress.marks
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/Makefile2 all
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/main.dir/build.make CMakeFiles/main.dir/depend
cd /Users/.../Desktop/cpp/build && /usr/local/Cellar/cmake/3.14.5/bin/cmake -E cmake_depends "Unix Makefiles" /Users/.../Desktop/cpp /Users/.../Desktop/cpp /Users/.../Desktop/cpp/build /Users/.../Desktop/cpp/build /Users/.../Desktop/cpp/build/CMakeFiles/main.dir/DependInfo.cmake --color=
Dependee "/Users/.../Desktop/cpp/build/CMakeFiles/main.dir/DependInfo.cmake" is newer than depender "/Users/.../Desktop/cpp/build/CMakeFiles/main.dir/depend.internal".
Dependee "/Users/.../Desktop/cpp/build/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/Users/.../Desktop/cpp/build/CMakeFiles/main.dir/depend.internal".
Scanning dependencies of target main
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/main.dir/build.make CMakeFiles/main.dir/build
[ 50%] Building CXX object CMakeFiles/main.dir/main.cpp.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++    -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk   -o CMakeFiles/main.dir/main.cpp.o -c /Users/.../Desktop/cpp/main.cpp
[100%] Linking CXX executable main
/usr/local/Cellar/cmake/3.14.5/bin/cmake -E cmake_link_script CMakeFiles/main.dir/link.txt --verbose=1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++   -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names  CMakeFiles/main.dir/main.cpp.o  -o main
[100%] Built target main
/usr/local/Cellar/cmake/3.14.5/bin/cmake -E cmake_progress_start /Users/.../Desktop/cpp/build/CMakeFiles 0

有没有一个选项可以让你得到这个。我不认为这是CMake的责任。@john我编辑以使其更清楚,是的,我尝试了
make
make VERBOSE=1
,但它只显示与CMake相关的命令。如果我查看MaFe文件,它只包含CGuess相关命令和C++编译器相关命令。有点Google显示,使VBOSE=1 是正确答案。makefile只能包含make命令,它包含CMake命令是没有意义的(否则您将需要CMake而不是make来运行它)。我想我们必须看看您生成的makefile的示例。请尽可能简单。我刚刚添加了一个hello world示例,其中包含所有相关文件以及使用
make VERBOSE=1
返回的消息。正如在最后一个代码块中可以看到的,没有提到C++文件是如何被编译的,这就是我想知道的。但是在你的输出中,
/Applications/Xcode.app/Contents/Developer/toolschains/Xcode default.xtoolschain/usr/bin/c++-isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk-o CMakeFiles/main.dir/main.cpp.o-c/Users/../Desktop/cpp/main.cpp
是如何文件已编译。是否有一个
make
选项可以为您提供此选项。我不认为这是CMake的责任。@john我编辑以使其更清楚,是的,我尝试了
make
make VERBOSE=1
,但它只显示与CMake相关的命令。如果我查看MaFe文件,它只包含CGuess相关命令和C++编译器相关命令。有点Google显示,使VBOSE=1 是正确答案。makefile只能包含make命令,它包含CMake命令是没有意义的(否则您将需要CMake而不是make来运行它)。我想我们必须看看您生成的makefile的示例。请尽可能简单。我刚刚添加了一个hello world示例,其中包含所有相关文件以及使用
make VERBOSE=1
返回的消息。正如在最后一个代码块中可以看到的,没有提到C++文件是如何被编译的,这就是我想知道的。但是在你的输出中,
/Applications/Xcode.app/Contents/Developer/toolschains/Xcode default.xtoolschain/usr/bin/c++-isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk-o CMakeFiles/main.dir/main.cpp.o-c/Users/../Desktop/cpp/main.cpp
是如何文件已编译。
/usr/local/Cellar/cmake/3.14.5/bin/cmake -S/Users/.../Desktop/cpp -B/Users/.../Desktop/cpp/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/Cellar/cmake/3.14.5/bin/cmake -E cmake_progress_start /Users/.../Desktop/cpp/build/CMakeFiles /Users/.../Desktop/cpp/build/CMakeFiles/progress.marks
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/Makefile2 all
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/main.dir/build.make CMakeFiles/main.dir/depend
cd /Users/.../Desktop/cpp/build && /usr/local/Cellar/cmake/3.14.5/bin/cmake -E cmake_depends "Unix Makefiles" /Users/.../Desktop/cpp /Users/.../Desktop/cpp /Users/.../Desktop/cpp/build /Users/.../Desktop/cpp/build /Users/.../Desktop/cpp/build/CMakeFiles/main.dir/DependInfo.cmake --color=
Dependee "/Users/.../Desktop/cpp/build/CMakeFiles/main.dir/DependInfo.cmake" is newer than depender "/Users/.../Desktop/cpp/build/CMakeFiles/main.dir/depend.internal".
Dependee "/Users/.../Desktop/cpp/build/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/Users/.../Desktop/cpp/build/CMakeFiles/main.dir/depend.internal".
Scanning dependencies of target main
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/main.dir/build.make CMakeFiles/main.dir/build
[ 50%] Building CXX object CMakeFiles/main.dir/main.cpp.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++    -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk   -o CMakeFiles/main.dir/main.cpp.o -c /Users/.../Desktop/cpp/main.cpp
[100%] Linking CXX executable main
/usr/local/Cellar/cmake/3.14.5/bin/cmake -E cmake_link_script CMakeFiles/main.dir/link.txt --verbose=1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++   -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names  CMakeFiles/main.dir/main.cpp.o  -o main
[100%] Built target main
/usr/local/Cellar/cmake/3.14.5/bin/cmake -E cmake_progress_start /Users/.../Desktop/cpp/build/CMakeFiles 0