CMakeLists.txt 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. ####################################################
  2. ## library individual settings
  3. #library name (name is appended to "nice_" to form the target library name)
  4. set(the_library "segmentation")
  5. #define variable nice_<libname>_HDR and nice_<libname>_SRC for library header and source files (don't include progs and test source files here)
  6. include( corefiles.cmake)
  7. #define variable nice_<libname>_PROGFILES_HDR and nice_<libname>_PROGFILES_SRC for program header and source files (don't include library and test source files here)
  8. include( progfiles.cmake)
  9. #define variable nice_<libname>_TESTFILES_HDR and nice_<libname>_TESTFILES_SRC for unit test header and source files (don't include library and progs source files here)
  10. include( testfiles.cmake)
  11. #add linkage dependencies to other libraries here
  12. set("nice_${the_library}_LINKING_DEPENDENCIES" "nice_core")
  13. #####################################################
  14. message(STATUS "adding library ${the_library}")
  15. nice_build_library()
  16. nice_add_progs()
  17. nice_add_unittests()
  18. #####
  19. set(the_module "nice_${the_library}")
  20. if(ENABLE_SOLUTION_FOLDERS)
  21. set_target_properties(${the_module} PROPERTIES FOLDER "modules")
  22. endif()
  23. set_target_properties(${the_module} PROPERTIES
  24. OUTPUT_NAME "${the_module}${OPENCV_DLLVERSION}"
  25. DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
  26. ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}
  27. RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
  28. INSTALL_NAME_DIR lib
  29. )
  30. if(BUILD_SHARED_LIBS)
  31. if(MSVC)
  32. set_target_properties(${the_module} PROPERTIES DEFINE_SYMBOL CVAPI_EXPORTS)
  33. else()
  34. add_definitions(-DCVAPI_EXPORTS)
  35. endif()
  36. endif()
  37. if(MSVC)
  38. if(CMAKE_CROSSCOMPILING)
  39. set_target_properties(${the_module} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:secchk")
  40. endif()
  41. set_target_properties(${the_module} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:libc /DEBUG")
  42. endif()
  43. install(TARGETS ${the_module}
  44. RUNTIME DESTINATION bin COMPONENT main
  45. LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main
  46. ARCHIVE DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main
  47. )
  48. # # only "public" headers need to be installed
  49. # if(OPENCV_MODULE_${the_module}_HEADERS AND ";${OPENCV_MODULES_PUBLIC};" MATCHES ";${the_module};")
  50. # foreach(hdr ${OPENCV_MODULE_${the_module}_HEADERS})
  51. # string(REGEX REPLACE "^.*opencv2/" "opencv2/" hdr2 "${hdr}")
  52. # if(hdr2 MATCHES "^(opencv2/.*)/[^/]+.h(..)?$")
  53. # install(FILES ${hdr} DESTINATION "${OPENCV_INCLUDE_INSTALL_PATH}/${CMAKE_MATCH_1}" COMPONENT main)
  54. # endif()
  55. # endforeach()
  56. # endif()