Wl,--stack,4194304 错误视觉 Studio/CMake
Wl,--stack,4194304 error Visual Studio/CMake
所以我使用 CMake 构建了一个开源项目并在 Visual Studio 中打开它,但我收到此错误:
Command line error D8021: invalid numeric argument
'/Wl,--stack,4194304'
我的 CMakeLists.txt 有这个:
if(WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--stack,4194304 -fpermissive") endif()
我不确定这是什么或如何修复。感谢任何帮助
您正在提供用于 GCC 的 Visual Studio 编译器开关。
if (WIN32)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--stack,4194304 -fpermissive")
elseif(MSVC)
# add options for Visual C/C++ Compiler here
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /F 4194304")
endif()
endif()
另请参阅In cmake, how can I test if the compiler is Clang?如何可靠地识别您的编译器。
有关许可标志,请参阅Visual Studio (2015) fpermissive equivalent flag。
编辑:根据讨论为 GCC 添加了更可靠的编译器检查。
所以我使用 CMake 构建了一个开源项目并在 Visual Studio 中打开它,但我收到此错误:
Command line error D8021: invalid numeric argument '/Wl,--stack,4194304'
我的 CMakeLists.txt 有这个:
if(WIN32) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--stack,4194304 -fpermissive") endif()
我不确定这是什么或如何修复。感谢任何帮助
您正在提供用于 GCC 的 Visual Studio 编译器开关。
if (WIN32)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--stack,4194304 -fpermissive")
elseif(MSVC)
# add options for Visual C/C++ Compiler here
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /F 4194304")
endif()
endif()
另请参阅In cmake, how can I test if the compiler is Clang?如何可靠地识别您的编译器。
有关许可标志,请参阅Visual Studio (2015) fpermissive equivalent flag。
编辑:根据讨论为 GCC 添加了更可靠的编译器检查。