CMake/CPack/Examples/Linux/DEB: Difference between revisions
From KitwarePublic
< CMake
Jump to navigationJump to search
Daviddoria (talk | contribs) (Created page with "==DistanceBetweenPoints.cxx== <source lang="cpp"> #include <vtkMath.h> int main(int, char *[]) { // Create two points. double p0[3] = {0.0, 0.0, 0.0}; double p1[3] = {1.0...") |
Daviddoria (talk | contribs) |
||
Line 26: | Line 26: | ||
<source lang="cmake"> | <source lang="cmake"> | ||
cmake_minimum_required(VERSION 2.6) | cmake_minimum_required(VERSION 2.6) | ||
PROJECT(DistanceBetweenPoints) | PROJECT(DistanceBetweenPoints) | ||
FIND_PACKAGE(VTK REQUIRED) | FIND_PACKAGE(VTK REQUIRED) | ||
INCLUDE(${VTK_USE_FILE}) | INCLUDE(${VTK_USE_FILE}) | ||
ADD_EXECUTABLE(DistanceBetweenPoints DistanceBetweenPoints.cxx) | |||
INSTALL(TARGETS DistanceBetweenPoints DESTINATION distance) | |||
#SET(CPACK_GENERATOR "RPM") | |||
SET(CPACK_GENERATOR "DEB") | |||
#SET(CPACK_DEBIAN_PACKAGE_NAME distancebetweenpoints) | |||
#SET(CPACK_DEBIAN_PACKAGE_VERSION 1.0) | |||
#SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386) | |||
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "David Doria") | |||
#SET(CPACK_DEBIAN_PACKAGE_Description "find distance between points") | |||
INCLUDE(CPack) | INCLUDE(CPack) | ||
#make package | |||
#sudo dpkg -i DistanceBetweenPoints-0.1.1-Linux.deb | |||
#results in: | |||
#/usr/distance/DistanceBetweenPoints | |||
</source> | </source> |
Revision as of 13:12, 16 November 2010
DistanceBetweenPoints.cxx
<source lang="cpp">
- include <vtkMath.h>
int main(int, char *[]) {
// Create two points. double p0[3] = {0.0, 0.0, 0.0}; double p1[3] = {1.0, 1.0, 1.0}; // Find the squared distance between the points. double squaredDistance = vtkMath::Distance2BetweenPoints(p0, p1);
// Take the square root to get the Euclidean distance between the points. double distance = sqrt(squaredDistance); // Output the results. std::cout << "SquaredDistance = " << squaredDistance << std::endl; std::cout << "Distance = " << distance << std::endl;
return EXIT_SUCCESS;
} </source>
CMakeLists.txt
<source lang="cmake"> cmake_minimum_required(VERSION 2.6)
PROJECT(DistanceBetweenPoints)
FIND_PACKAGE(VTK REQUIRED) INCLUDE(${VTK_USE_FILE})
ADD_EXECUTABLE(DistanceBetweenPoints DistanceBetweenPoints.cxx) INSTALL(TARGETS DistanceBetweenPoints DESTINATION distance)
- SET(CPACK_GENERATOR "RPM")
SET(CPACK_GENERATOR "DEB")
- SET(CPACK_DEBIAN_PACKAGE_NAME distancebetweenpoints)
- SET(CPACK_DEBIAN_PACKAGE_VERSION 1.0)
- SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386)
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "David Doria")
- SET(CPACK_DEBIAN_PACKAGE_Description "find distance between points")
INCLUDE(CPack)
- make package
- sudo dpkg -i DistanceBetweenPoints-0.1.1-Linux.deb
- results in:
- /usr/distance/DistanceBetweenPoints
</source>