• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

cmake-maven-project/cmake-maven-project: Project to enable using CMake from a Ma ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

cmake-maven-project/cmake-maven-project

开源软件地址(OpenSource Url):

https://github.com/cmake-maven-project/cmake-maven-project

开源编程语言(OpenSource Language):

Java 83.5%

开源软件介绍(OpenSource Introduction):

CMake-Maven-Project build-status

Introduction

A Maven project for the CMake build system. It can be used by including it as a plugin within your Maven project's pom.xml file.

This repository originally lived on Google Code and was migrated to GitHub (and Git) after Google Code shut down.

Sample Usage

Generate Goal

<plugin>
  <groupId>com.googlecode.cmake-maven-project</groupId>
  <artifactId>cmake-maven-plugin</artifactId>
  <version>3.23.2-b1</version>
  <executions>
    <execution>
      <id>cmake-generate</id>
      <goals>
        <goal>generate</goal>
      </goals>
      <configuration>
        <sourcePath>
          <!-- The directory containing CMakeLists -->
        </sourcePath>
        <targetPath>
          <!-- The directory write the project files to -->
        </targetPath>
        <generator>
          <!--
          Optional: Overrides the default generator used by cmake.
          The list of available values can be found at 
          https://cmake.org/cmake/help/v3.22/manual/cmake-generators.7.html
          -->
        </generator>
        <environmentVariables>
          <!--
          Optional: Additional environment variables to expose to cmake. If a variable was already set,
          overrides the previous value.             
          -->              
          <key>value</key>
        </environmentVariables>
        <options>
          <!--
          Optional: One or more options found at https://cmake.org/cmake/help/v3.22/manual/cmake.1.html
          For example:
          -->
          <option>-DBUILD_THIRDPARTY:bool=on</option>
        </options>
      </configuration>
    </execution>
  </executions>
</plugin>

Compile Goal

<plugin>
  <groupId>com.googlecode.cmake-maven-project</groupId>
  <artifactId>cmake-maven-plugin</artifactId>
  <version>3.23.2-b1</version>
  <executions>
    <execution>
      <id>cmake-compile</id>
      <goals>
        <goal>compile</goal>
      </goals>
      <configuration>
        <config>
          <!-- Optional: the build configuration (e.g. "x64|Release") -->
        </config>
        <target>
          <!-- Optional: the build "target" -->
        </target>
        <projectDirectory>
          <!-- "targetPath" from the "generate" goal -->
        </projectDirectory>
        <environmentVariables>
          <key>value</key>
        </environmentVariables>
      </configuration>
    </execution>
  </executions>
</plugin>

Test Goal

<plugin>
  <groupId>com.googlecode.cmake-maven-project</groupId>
  <artifactId>cmake-maven-plugin</artifactId>
  <version>3.23.2-b1</version>
  <executions>
    <execution>
      <id>cmake-test</id>
      <goals>
        <goal>test</goal>
      </goals>
      <configuration>
        <!-- "buildDirectory" is "targetPath" from the "generate" goal -->
        <buildDirectory>${project.build.directory}</buildDirectory>
        <!-- Optional: do not fail the build on test failures. false by default. -->
        <testFailureIgnore>true</testFailureIgnore>
        <!-- Optional: skip only ctest tests. false by default. -->
        <ctest.skip.tests>true</ctest.skip.tests>
        <!-- Optional: Skip all Maven tests. false by default -->
        <maven.test.skip>true</maven.test.skip>
        <!-- Optional: the number of threads tests should use -->
        <threadCount>2</threadCount>
        <!-- Optional: dashboard configuration; used with CTestConfig.cmake -->
        <dashboard>Experimental</dashboard>
      </configuration>
    </execution>
  </executions>
</plugin>

Examples

The following projects contain examples of how to use this plugin:

Requirements API

Building instructions

To build the plugin, run:

mvn install

To clean an old build, run:

mvn clean

By default, Maven will activate the right profile based on your JVM:

  • windows-x86_64
  • linux-x86_64
  • linux-arm_32
  • mac-x86_64
  • mac-aarch64

If detection does not work, or you wish to override it then set -P<profile>.

For instance, when building for 64-bit Linux machines, use:

mvn -Plinux-x86_64 install

Using a local CMake installation

Sometimes it is preferable or necessary to use a preexisting CMake installation. cmake.org doesn't provide binaries for some platforms, such as Raspberry Pi. In such cases, users can install the binaries themselves (typically using package managers like apt-get) and point the plugin at them.

  1. Set ${cmake.download} to false.
  2. Optionally set ${cmake.dir} to the directory containing the binaries (e.g. /usr/bin). Otherwise, the plugin will expect the binaries to be on the PATH.

That's it! To learn more about CMake itself, consult the CMake.org website.

License

CMake-Maven-Project is released under an Apache License 2.0




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap