CMakeLists.txt 2.6 KB

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