cmake: CMP0026 NEW

pull/9432/head
Alexander Alekhin 7 years ago committed by Alexander Alekhin
parent d25b04149a
commit 355553b0a6
  1. 5
      CMakeLists.txt
  2. 3
      cmake/OpenCVDetectAndroidSDK.cmake
  3. 18
      cmake/OpenCVGenPkgconfig.cmake
  4. 3
      modules/java/CMakeLists.txt

@ -45,8 +45,7 @@ else()
endif()
if(POLICY CMP0026)
# silence cmake 3.0+ warnings about reading LOCATION attribute
cmake_policy(SET CMP0026 OLD)
cmake_policy(SET CMP0026 NEW)
endif()
if (POLICY CMP0042)
@ -1017,7 +1016,7 @@ if(HAVE_OPENCL)
set(__libs "")
foreach(l ${OPENCL_LIBRARIES})
if(TARGET ${l})
get_target_property(p ${l} LOCATION)
get_target_property(p ${l} IMPORTED_LOCATION)
if(p MATCHES NOTFOUND)
list(APPEND __libs "${l}")
else()

@ -309,9 +309,8 @@ macro(add_android_project target path)
LIBRARY_OUTPUT_DIRECTORY "${android_proj_bin_dir}/libs/${ANDROID_NDK_ABI_NAME}"
)
get_target_property(android_proj_jni_location "${JNI_LIB_NAME}" LOCATION)
if (NOT (CMAKE_BUILD_TYPE MATCHES "debug"))
add_custom_command(TARGET ${JNI_LIB_NAME} POST_BUILD COMMAND ${CMAKE_STRIP} --strip-unneeded "${android_proj_jni_location}")
add_custom_command(TARGET ${JNI_LIB_NAME} POST_BUILD COMMAND ${CMAKE_STRIP} --strip-unneeded "$<TARGET_FILE:${JNI_LIB_NAME}>")
endif()
endif()

@ -46,16 +46,16 @@ endif()
set(OpenCV_LIB_COMPONENTS_)
foreach(CVLib ${OpenCV_LIB_COMPONENTS})
get_target_property(libloc ${CVLib} LOCATION_${CMAKE_BUILD_TYPE})
if(libloc MATCHES "3rdparty")
set(libpath "\${exec_prefix}/share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH}")
else()
set(libpath "\${exec_prefix}/${OPENCV_LIB_INSTALL_PATH}")
get_target_property(libname ${CVLib} OUTPUT_NAME_${CMAKE_BUILD_TYPE})
if(NOT libname)
get_target_property(libname ${CVLib} OUTPUT_NAME)
endif()
if(NOT libname)
set(libname "${CVLib}")
endif()
list(APPEND OpenCV_LIB_COMPONENTS_ "-L${libpath}")
get_filename_component(libname ${CVLib} NAME_WE)
string(REGEX REPLACE "^lib" "" libname "${libname}")
set(libpath "\${exec_prefix}/${OPENCV_LIB_INSTALL_PATH}")
list(APPEND OpenCV_LIB_COMPONENTS_ "-L${libpath}")
list(APPEND OpenCV_LIB_COMPONENTS_ "-l${libname}")
endforeach()
@ -66,7 +66,7 @@ if(OpenCV_EXTRA_COMPONENTS)
if(TARGET "${extra_component}")
get_target_property(extra_component_is_imported "${extra_component}" IMPORTED)
if(extra_component_is_imported)
get_target_property(extra_component "${extra_component}" LOCATION)
get_target_property(extra_component "${extra_component}" IMPORTED_LOCATION)
endif()
endif()

@ -331,10 +331,9 @@ if(ANDROID)
# force strip library after the build command
# because samples and tests will make a copy of the library before install
get_target_property(__opencv_java_location ${the_module} LOCATION)
# Turn off stripping in debug build
if ( NOT (CMAKE_BUILD_TYPE MATCHES "Debug"))
add_custom_command(TARGET ${the_module} POST_BUILD COMMAND ${CMAKE_STRIP} --strip-unneeded "${__opencv_java_location}")
add_custom_command(TARGET ${the_module} POST_BUILD COMMAND ${CMAKE_STRIP} --strip-unneeded "$<TARGET_FILE:${the_module}>")
endif()
endif()

Loading…
Cancel
Save