ITK/Examples/CMake/CheckForModule

From KitwarePublic
< ITK‎ | Examples
Revision as of 15:21, 20 October 2012 by Daviddoria (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

CheckForModule.cxx

<source lang="cpp">

  1. include "itkImage.h"
  1. 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})

  1. This should fail

if(NOT ITKTesting_LOADED)

 message(FATAL_ERROR "Testing module is required but not available.")

endif()

  1. 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>