### CMake Project Setup and Metadata Source: https://github.com/slicer/slicerairwaysegmentation/blob/master/CMakeLists.txt Configures the CMake build system for the AirwaySegmentation project. It defines the minimum CMake version, project name, and various metadata for the Slicer extension, including its homepage, category, contributors, description, and URLs for its icon and screenshots. ```cmake cmake_minimum_required(VERSION 3.16.3...3.19.7 FATAL_ERROR) project(AirwaySegmentation) #----------------------------------------------------------------------------- # Extension meta-information set(EXTENSION_HOMEPAGE "https://github.com/Slicer/SlicerAirwaySegmentation#airway-segmentation") set(EXTENSION_CATEGORY "Segmentation") set(EXTENSION_CONTRIBUTORS "Pietro Nardelli (University College Cork), Andras Lasso (PerkLab, Queen's University)") set(EXTENSION_DESCRIPTION "Automated airway segmentation in chest CT images") set(EXTENSION_ICONURL "https://raw.githubusercontent.com/Slicer/SlicerAirwaySegmentation/master/AirwaySegmentation-ICON.png") set(EXTENSION_SCREENSHOTURLS "https://raw.githubusercontent.com/Slicer/SlicerAirwaySegmentation/master/Screenshot01.jpg") ``` -------------------------------- ### CMake: Define Build Variables and Executable Target Source: https://github.com/slicer/slicerairwaysegmentation/blob/master/AirwaySegmentationCLI/Testing/Cxx/CMakeLists.txt This snippet defines source directories and the main executable name. It then adds an executable target named 'CLPTest' and links it with necessary libraries for execution and testing. ```cmake set(BASELINE ${CMAKE_CURRENT_SOURCE_DIR}/../../Data/Baseline) set(INPUT ${CMAKE_CURRENT_SOURCE_DIR}/../../Data/Input) set(TEMP "${CMAKE_BINARY_DIR}/Testing/Temporary") set(CLP ${MODULE_NAME}) #----------------------------------------------------------------------------- add_executable(${CLP}Test ${CLP}Test.cxx) target_link_libraries(${CLP}Test ${CLP}Lib ${SlicerExecutionModel_EXTRA_EXECUTABLE_TARGET_LIBRARIES}) set_target_properties(${CLP}Test PROPERTIES LABELS ${CLP}) ``` -------------------------------- ### Define Module Resources - CMake Source: https://github.com/slicer/slicerairwaysegmentation/blob/master/AirwaySegmentation/CMakeLists.txt Specifies the resource files, such as icons and UI definitions, required by the module. These resources enhance the user interface and visual presentation of the module in Slicer. ```cmake set(MODULE_PYTHON_RESOURCES Resources/Icons/${MODULE_NAME}.png Resources/UI/${MODULE_NAME}.ui ) ``` -------------------------------- ### Build CLI Target with SEMMacroBuildCLI in CMake Source: https://github.com/slicer/slicerairwaysegmentation/blob/master/AirwaySegmentationCLI/CMakeLists.txt This macro call uses SEMMacroBuildCLI to build the command-line interface executable. It specifies the target name, libraries, include directories, and additional source files. ```cmake SEMMacroBuildCLI( NAME ${MODULE_NAME} TARGET_LIBRARIES ${MODULE_TARGET_LIBRARIES} INCLUDE_DIRECTORIES ${MODULE_INCLUDE_DIRECTORIES} ADDITIONAL_SRCS ${MODULE_SRCS} ) ``` -------------------------------- ### CMake Dependency and Module Inclusion Source: https://github.com/slicer/slicerairwaysegmentation/blob/master/CMakeLists.txt Includes the Slicer build system files and adds subdirectories for the project's modules. This ensures that the project correctly integrates with the Slicer platform and includes its specific build logic. ```cmake #----------------------------------------------------------------------------- # Extension dependencies find_package(Slicer REQUIRED) include(${Slicer_USE_FILE}) #----------------------------------------------------------------------------- # Extension modules add_subdirectory(AirwaySegmentationCLI) add_subdirectory(AirwaySegmentation) ## NEXT_MODULE #----------------------------------------------------------------------------- include(${Slicer_EXTENSION_CPACK}) ``` -------------------------------- ### Define Module Sources and Libraries in CMake Source: https://github.com/slicer/slicerairwaysegmentation/blob/master/AirwaySegmentationCLI/CMakeLists.txt These snippets define lists for module source files and target libraries. They are used later in the build process to link dependencies and compile code. ```cmake set(MODULE_INCLUDE_DIRECTORIES ) set(MODULE_SRCS ) set(MODULE_TARGET_LIBRARIES ${ITK_LIBRARIES} ) ``` -------------------------------- ### CMake: Add External Data Test Target Source: https://github.com/slicer/slicerairwaysegmentation/blob/master/AirwaySegmentationCLI/Testing/Cxx/CMakeLists.txt This snippet uses the ExternalData CMake module to define a test named 'CLPTest'. It specifies the command to launch the executable and provides arguments for comparing generated data with expected baseline data, including input files. ```cmake #----------------------------------------------------------------------------- set(testname ${CLP}Test) ExternalData_add_test(${CLP}Data NAME ${testname} COMMAND ${SEM_LAUNCH_COMMAND} $ --compare DATA{${BASELINE}/${CLP}Test.nhdr,${CLP}Test.raw} ${TEMP}/${CLP}Test.nhdr ModuleEntryPoint --sigma 2.5 DATA{${INPUT}/CTHeadAxial.nhdr,CTHeadAxial.raw.gz} ${TEMP}/${CLP}Test.nhdr ) set_property(TEST ${testname} PROPERTY LABELS ${CLP}) ``` -------------------------------- ### Build Scripted Module - CMake Source: https://github.com/slicer/slicerairwaysegmentation/blob/master/AirwaySegmentation/CMakeLists.txt Configures the build process for a scripted module. This macro handles the necessary steps to integrate Python scripts and resources into the Slicer build system, enabling generic tests. ```cmake slicerMacroBuildScriptedModule( NAME ${MODULE_NAME} SCRIPTS ${MODULE_PYTHON_SCRIPTS} RESOURCES ${MODULE_PYTHON_RESOURCES} WITH_GENERIC_TESTS ) ``` -------------------------------- ### Find and Include SlicerExecutionModel in CMake Source: https://github.com/slicer/slicerairwaysegmentation/blob/master/AirwaySegmentationCLI/CMakeLists.txt This code finds the SlicerExecutionModel package and includes its use file. This is essential for modules that interact with the Slicer execution environment. ```cmake find_package(SlicerExecutionModel REQUIRED) include(${SlicerExecutionModel_USE_FILE}) ``` -------------------------------- ### Define Module Name and Python Scripts - CMake Source: https://github.com/slicer/slicerairwaysegmentation/blob/master/AirwaySegmentation/CMakeLists.txt Sets the module name and lists the Python scripts associated with the module. These scripts are essential for the module's functionality within the Slicer environment. ```cmake set(MODULE_NAME AirwaySegmentation) set(MODULE_PYTHON_SCRIPTS ${MODULE_NAME}.py ) ``` -------------------------------- ### Register Python Unit Tests - CMake Source: https://github.com/slicer/slicerairwaysegmentation/blob/master/AirwaySegmentation/CMakeLists.txt Registers a Python script as a unit test for the module if testing is enabled. This allows for automated testing of the module's functionality during the build process. ```cmake if(BUILD_TESTING) # Register the unittest subclass in the main script as a ctest. # Note that the test will also be available at runtime. slicer_add_python_unittest(SCRIPT ${MODULE_NAME}.py) # Additional build-time testing add_subdirectory(Testing) endif() ``` -------------------------------- ### Configure ITK Components and Find Package in CMake Source: https://github.com/slicer/slicerairwaysegmentation/blob/master/AirwaySegmentationCLI/CMakeLists.txt This section configures the specific components of the ITK library required by the module and then finds the ITK package. It also sets a flag to disable the ITK IO factory registration manager. ```cmake set(${PROJECT_NAME}_ITK_COMPONENTS ITKIOImageBase ITKLabelMap ITKRegionGrowing ITKSmoothing ) find_package(ITK 4.6 COMPONENTS ${${PROJECT_NAME}_ITK_COMPONENTS} REQUIRED) set(ITK_NO_IO_FACTORY_REGISTER_MANAGER 1) # See Libs/ITKFactoryRegistration/CMakeLists.txt include(${ITK_USE_FILE}) ``` -------------------------------- ### CMake: Add External Data Target Source: https://github.com/slicer/slicerairwaysegmentation/blob/master/AirwaySegmentationCLI/Testing/Cxx/CMakeLists.txt This snippet adds a target for managing external data using the ExternalData CMake module. This is typically used to download and manage datasets required for the project's tests. ```cmake #----------------------------------------------------------------------------- ExternalData_add_target(${CLP}Data) ``` -------------------------------- ### Define Module Name in CMake Source: https://github.com/slicer/slicerairwaysegmentation/blob/master/AirwaySegmentationCLI/CMakeLists.txt This snippet defines the name of the module being built. It's a common practice in CMake to set module names for clarity and organization. ```cmake set(MODULE_NAME AirwaySegmentationCLI) ``` -------------------------------- ### Conditional Testing Subdirectory in CMake Source: https://github.com/slicer/slicerairwaysegmentation/blob/master/AirwaySegmentationCLI/CMakeLists.txt This snippet conditionally adds a 'Testing' subdirectory to the build if testing is enabled via the BUILD_TESTING variable. This is a standard CMake pattern for managing tests. ```cmake if(BUILD_TESTING) add_subdirectory(Testing) endif() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.