CMakeLists.txt 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. ####################################################
  2. ## library individual settings
  3. #library name (name is appended to "nice_" to form the target library name)
  4. set(the_library "core")
  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" "")
  13. if(MATIO_FOUND)
  14. list(APPEND nice_${the_library}_LINKING_DEPENDENCIES ${MATIO_LIBRARIES})
  15. endif(MATIO_FOUND)
  16. #####################################################
  17. message(STATUS "adding library ${the_library}")
  18. nice_build_library()
  19. nice_add_progs()
  20. nice_add_unittests()
  21. #####
  22. set(the_module "nice_${the_library}")
  23. if(ENABLE_SOLUTION_FOLDERS)
  24. set_target_properties(${the_module} PROPERTIES FOLDER "modules")
  25. endif()
  26. set_target_properties(${the_module} PROPERTIES
  27. OUTPUT_NAME "${the_module}${OPENCV_DLLVERSION}"
  28. DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
  29. ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}
  30. RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
  31. INSTALL_NAME_DIR lib
  32. )
  33. if(BUILD_SHARED_LIBS)
  34. if(MSVC)
  35. set_target_properties(${the_module} PROPERTIES DEFINE_SYMBOL CVAPI_EXPORTS)
  36. else()
  37. add_definitions(-DCVAPI_EXPORTS)
  38. endif()
  39. endif()
  40. if(MSVC)
  41. if(CMAKE_CROSSCOMPILING)
  42. set_target_properties(${the_module} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:secchk")
  43. endif()
  44. set_target_properties(${the_module} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:libc /DEBUG")
  45. endif()
  46. install(TARGETS ${the_module}
  47. RUNTIME DESTINATION bin COMPONENT main
  48. LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main
  49. ARCHIVE DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main
  50. )
  51. # # only "public" headers need to be installed
  52. # if(OPENCV_MODULE_${the_module}_HEADERS AND ";${OPENCV_MODULES_PUBLIC};" MATCHES ";${the_module};")
  53. # foreach(hdr ${OPENCV_MODULE_${the_module}_HEADERS})
  54. # string(REGEX REPLACE "^.*opencv2/" "opencv2/" hdr2 "${hdr}")
  55. # if(hdr2 MATCHES "^(opencv2/.*)/[^/]+.h(..)?$")
  56. # install(FILES ${hdr} DESTINATION "${OPENCV_INCLUDE_INSTALL_PATH}/${CMAKE_MATCH_1}" COMPONENT main)
  57. # endif()
  58. # endforeach()
  59. # endif()