[使用MinGW-w64在MSYS2上编译基础

问题描述 投票:0回答:1

我正在尝试遵循these instructions使用MinGW-w64编译器在MSYS2上编译安装BASIS(CMake构建系统和软件实施标准)。但是,ccmake ..步骤失败:

-bash:ccmake:找不到命令

我尝试按pacman -Ss ccmake搜索MSYS2软件包,但没有结果。所以我认为我必须使用命令行cmake代替:

cmake -DCMAKE_INSTALL_PREFIX:PATH=~/local -DBUILD_APPLICATIONS:BOOL=ON -DBUILD_EXAMPLE:BOOL=ON ..

失败者:

CMake Error at src/cmake/modules/ProjectTools.cmake:876 (message):
  CMAKE_INSTALL_PREFIX must be an absolute path!
Call Stack (most recent call first):
  src/cmake/modules/ProjectTools.cmake:2525 (basis_installtree_asserts)
  src/cmake/modules/ProjectTools.cmake:2751 (basis_project_begin)
  CMakeLists.txt:69 (basis_project_impl)

作为一种解决方法,我将~/local更改为/home/<userName>/local,这似乎正在起作用。但是,我不知道MakeFile在哪里,原因是在运行make .时出现错误:

mingw32-make:***未指定目标,也未找到任何makefile。停止。

假设我在alias make='mingw32-make文件中有~/.bashrc。如果您能帮助我知道问题出在哪里以及如何解决,我将不胜感激。我已经安装了MSYS2-MinGW-w64软件包mingw64/mingw-w64-x86_64-cmake。我的Windows版本是1909,MSYS_NT-10.0-18363是我的环境。

P.S。查看CMake的输出,现在我看到实际上是一个警告:

CMake Warning (dev) in CMakeLists.txt:
  No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as

    project(ProjectName)

  near the top of the file, but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.

对此项目有点讽刺,但是我不确定这是否是编译失败的原因。

cmake compilation mingw-w64 msys2
1个回答
0
投票

好的,我想我通过使用MVS编译器解决了这个问题:

  • cmake -DCMAKE_INSTALL_PREFIX:PATH=/home/<userName>/local -DBUILD_APPLICATIONS:BOOL=ON -DBUILD_EXAMPLE:BOOL=ON .. -G "Visual Studio 15 2017 Win64"
  • cmake --build . --config release --target install
  • 可执行文件是~/local/Bin/basisproject.cmd,文件扩展名很奇怪,但似乎正在运行!
© www.soinside.com 2019 - 2024. All rights reserved.