ITK/Examples/CMake/CheckForModule

From KitwarePublic
< ITK‎ | Examples
Revision as of 10: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

#include "itkImage.h"

#include <iostream>

int main(int argc, char *argv[])
{

  return 0;
}
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})