ITK/Examples/CMake/CheckForModule: Difference between revisions

From KitwarePublic
< ITK‎ | Examples
Jump to navigationJump to search
(Created page with "==CheckForModule.cxx== <source lang="cpp"> #include "itkImage.h" #include <iostream> int main(int argc, char *argv[]) { return 0; } </source> <source lang="cmake"> cmake_mi...")
 
(Deprecated content that is moved to sphinxed)
 
Line 1: Line 1:
==CheckForModule.cxx==
{{warning|1=The media wiki content on this page is no longer maintained. The examples presented on the https://itk.org/Wiki/* pages likely require ITK version 4.13 or earlier releasesIn many cases, the examples on this page no longer conform to the best practices for modern ITK versions.}}
<source lang="cpp">
#include "itkImage.h"
 
#include <iostream>
 
int main(int argc, char *argv[])
{
 
  return 0;
}
</source>
 
<source lang="cmake">
cmake_minimum_required(VERSION 2.6)
 
PROJECT(CheckForModule)
 
FIND_PACKAGE(ITK REQUIRED ITKCommon)
INCLUDE(${ITK_USE_FILE})
 
# This should fail
if(NOT ITKTesting_LOADED)
  message(FATAL_ERROR "Testing module is required but not available.")
endif()
 
# This should pass
if(NOT ITKCommon_LOADED)
   message(FATAL_ERROR "Common module is required but not available.")
endif()
 
ADD_EXECUTABLE(CheckForModule CheckForModule.cxx)
TARGET_LINK_LIBRARIES(CheckForModule ${ITK_LIBRARIES})
 
</source>

Latest revision as of 23:42, 7 June 2019

Warning: The media wiki content on this page is no longer maintained. The examples presented on the https://itk.org/Wiki/* pages likely require ITK version 4.13 or earlier releases. In many cases, the examples on this page no longer conform to the best practices for modern ITK versions.