Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
usFunctionCreateTestModule.cmake
Go to the documentation of this file.
1 
3 
4  add_library(${name} ${_srcs})
5  set_property(TARGET ${name}
6  APPEND PROPERTY COMPILE_DEFINITIONS US_MODULE_NAME=${name})
7  set_property(TARGET ${name} PROPERTY US_MODULE_NAME ${name})
8  if(NOT US_BUILD_SHARED_LIBS OR NOT BUILD_SHARED_LIBS)
9  set_property(TARGET ${name} APPEND PROPERTY COMPILE_DEFINITIONS US_STATIC_MODULE)
10  endif()
11  if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
12  get_property(_compile_flags TARGET ${name} PROPERTY COMPILE_FLAGS)
13  set_property(TARGET ${name} PROPERTY COMPILE_FLAGS "${_compile_flags} -fPIC")
14  endif()
15 
16  target_link_libraries(${name} ${${PROJECT_NAME}_TARGET} ${US_TEST_LINK_LIBRARIES} ${US_LINK_LIBRARIES})
17 
18  if(_res_files OR US_TEST_LINK_LIBRARIES)
19  usFunctionAddResources(TARGET ${name} WORKING_DIRECTORY ${_res_root}
20  FILES ${_res_files}
21  ZIP_ARCHIVES ${US_TEST_LINK_LIBRARIES})
22  endif()
23  if(_bin_res_files)
24  usFunctionAddResources(TARGET ${name} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/resources
25  FILES ${_bin_res_files})
26  endif()
27 
28  usFunctionEmbedResources(TARGET ${name} ${_mode})
29 
30  if(NOT US_TEST_SKIP_MODULE_LIST)
31  set(_us_test_module_libs "${_us_test_module_libs};${name}" CACHE INTERNAL "" FORCE)
32  endif()
33 
34 endmacro()
35 
36 function(usFunctionCreateTestModule name)
37  set(_srcs ${ARGN})
38  set(_res_files )
39  set(_bin_res_files )
42 endfunction()
43 
45  cmake_parse_arguments(US_TEST "SKIP_MODULE_LIST;LINK_RESOURCES;APPEND_RESOURCES" "RESOURCES_ROOT" "SOURCES;RESOURCES;BINARY_RESOURCES;LINK_LIBRARIES" "" ${ARGN})
46 
47  set(_mode )
48  if(US_TEST_LINK_RESOURCES)
49  set(_mode LINK)
50  elseif(US_TEST_APPEND_RESOURCES)
51  set(_mode APPEND)
52  endif()
53 
54  set(_srcs ${US_TEST_SOURCES})
55  usFunctionGetResourceSource(TARGET ${name} OUT _srcs ${_mode})
56  set(_res_files ${US_TEST_RESOURCES})
57  set(_bin_res_files ${US_TEST_BINARY_RESOURCES})
58  if(US_TEST_RESOURCES_ROOT)
59  set(_res_root ${US_TEST_RESOURCES_ROOT})
60  else()
61  set(_res_root ${CMAKE_CURRENT_SOURCE_DIR}/resources)
62  endif()
65 endfunction()
_us_create_test_module_helper()
usFunctionAddResources()
Add resources to a library or executable.
usFunctionCreateTestModuleWithResources(name)
usFunctionEmbedResources()
Embed resources in a library or executable.
usFunctionCreateTestModule(name)
usFunctionGetResourceSource()
Get a source file name for handling resource dependencies.
const std::string LINK
usFunctionGenerateModuleInit(src_var)
Generate a source file which handles proper initialization of a module.
const std::string TARGET