Clone wiki

cmake-maven-project / Home

A Maven project for the CMake build system.

Update: This project has moved to https://github.com/cmake-maven-project/cmake-maven-project

Sample Usage

"generate" goal

<plugin>
  <groupId>com.googlecode.cmake-maven-project</groupId>
  <artifactId>cmake-maven-plugin</artifactId>
  <version>2.8.11-b3</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>
          <!-- One of the generators defined at http://www.cmake.org/cmake/help/v2.8.10/cmake.html#section_Generators -->
        </generator>
        <environmentVariables>
          <key>value</key>
        </environmentVariables>
        <options>
          <!--
            Optional: One or more options found at http://www.cmake.org/cmake/help/v2.8.10/cmake.html#section_Options
            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>2.8.11-b3</version>
  <executions>
    <execution>
      <id>cmake-compile</id>
      <goals>
        <goal>compile</goal>
      </goals>
      <configuration>
        <config>
          <!-- Optional: the build configuration (e.g. "Release|x64") -->
        </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>2.8.11-b4</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 way to not fail the build on test failures -->
        <!-- <testFailureIgnore>true</testFailureIgnore> -->
    <!-- Optional way to skip just the ctest tests -->
        <!-- <ctest.skip.tests>true</ctest.skip.tests> -->
    <!-- Optional/standard way to skip all Maven tests -->
        <!-- <maven.test.skip>true</maven.test.skip> -->
    <!-- Optional way to configure number of threads tests should use -->
        <!-- <threadCount>2</threadCount> -->
        <!-- Optional dashboard configuration; used with CTestConfig.cmake -->
        <!-- <dashboard>Experimental</dashboard> -->
      </configuration>
    </execution>
  </executions>
</plugin>

Downloads available from Maven.

See Building Instructions for more information.
User discussion group: http://groups.google.com/group/cmake-maven-project-users

License

Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0

Updated