CMake/CPack/BundleUtilities/Examples/Linux/VTK: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
(Created page with "==VTKIncludeTest.cpp== <source lang="cmake"> #include <vtkMath.h> int main(int, char *[]) { double p0[3] = {0.0, 0.0, 0.0}; double p1[3] = {1.0, 1.0, 1.0}; double squar...")
 
(Replace content with link to new CMake community wiki)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==VTKIncludeTest.cpp==
{{CMake/Template/Moved}}
<source lang="cmake">
#include <vtkMath.h>
int main(int, char *[])
{
  double p0[3] = {0.0, 0.0, 0.0};
  double p1[3] = {1.0, 1.0, 1.0};
  double squaredDistance = vtkMath::Distance2BetweenPoints(p0, p1);
  std::cout << "SquaredDistance = " << squaredDistance << std::endl;
  return EXIT_SUCCESS;
}
</source>


==CMakeLists.txt==
This page has moved [https://gitlab.kitware.com/cmake/community/wikis/doc/cpack/examples/linux/VTK here].
<source lang="cmake">
PROJECT (VTKIncludeTest)
cmake_minimum_required(VERSION 2.8)
 
FIND_PACKAGE(VTK REQUIRED)
INCLUDE(${VTK_USE_FILE})
 
ADD_EXECUTABLE(VTKIncludeTest VTKIncludeTest.cpp)
TARGET_LINK_LIBRARIES(VTKIncludeTest vtkHybrid)
 
# The installation commands start here
SET(plugin_dest_dir bin)
SET(qtconf_dest_dir bin)
SET(APPS "\${CMAKE_INSTALL_PREFIX}/bin/VTKIncludeTest")
 
# Install the application
INSTALL(TARGETS VTKIncludeTest
    BUNDLE DESTINATION . COMPONENT Runtime
    RUNTIME DESTINATION bin COMPONENT Runtime
    )
 
# Use BundleUtilities to get all other dependencies for the application to work.
# It takes a bundle or executable along with possible plugins and inspects it
# for dependencies.  If they are not system dependencies, they are copied.
 
# directories to look for dependencies
SET(DIRS ${VTK_LIBRARY_DIRS})
#./bin/libvtkHybrid.a
 
# Now the work of copying dependencies into the bundle/package
# The quotes are escaped and variables to use at install time have their $ escaped
INSTALL(CODE "
    file(GLOB_RECURSE QTPLUGINS
      \"\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/plugins/*${CMAKE_SHARED_LIBRARY_SUFFIX}\")
    include(BundleUtilities)
    fixup_bundle(\"${APPS}\" \"\${QTPLUGINS}\" \"${DIRS}\")
    " COMPONENT Runtime)
 
 
SET(CPACK_GENERATOR "DEB")
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "David Doria") #required
include(CPack)
</source>

Latest revision as of 15:40, 30 April 2018


The CMake community Wiki has moved to the Kitware GitLab Instance.

This page has moved here.