Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/263.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.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#而不使用32位标志 我有一个Cube项目,它用C++创建一个DLL,一个C型Windows窗体可执行程序,加载DLL。_C#_Cmake_Anycpu - Fatal编程技术网

CMake-构建C#而不使用32位标志 我有一个Cube项目,它用C++创建一个DLL,一个C型Windows窗体可执行程序,加载DLL。

CMake-构建C#而不使用32位标志 我有一个Cube项目,它用C++创建一个DLL,一个C型Windows窗体可执行程序,加载DLL。,c#,cmake,anycpu,C#,Cmake,Anycpu,我使用CMake生成器:Visual Studio 15 2017 Win64 无论我做什么(一个例子是设置compile选项:/platform:anycpu),我都不能让CMake没有compile标志:/platform:anycpu32bitpereferred 当我在VS2017中打开生成的VS项目时,它在构建选项中设置了“首选32位”标志 有没有办法强迫CMake在没有设置此标志的情况下生成我的C#项目? 它会导致运行时链接问题,除非我使用32位DLL。此问题似乎是CMake中更大问

我使用CMake生成器:Visual Studio 15 2017 Win64

无论我做什么(一个例子是设置compile选项:
/platform:anycpu
),我都不能让CMake没有compile标志:
/platform:anycpu32bitpereferred

当我在VS2017中打开生成的VS项目时,它在构建选项中设置了“首选32位”标志

有没有办法强迫CMake在没有设置此标志的情况下生成我的C#项目?
它会导致运行时链接问题,除非我使用32位DLL。

此问题似乎是CMake中更大问题的一部分:

我找到了一个解决方法,即在构建之前设置以下环境变量:

set Prefer32Bit=false

然而,值得一提的是,这是为整个构建设置的,而不是为每个项目设置的。

这对我来说很有效。在cmake 3.14上测试,但应适用于3.8.2及以上版本

set_属性(TARGET${TARGET_NAME}属性VS_GLOBAL_Prefer32Bit“false”)