X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=cmake%2FSalomeMacros.cmake;h=e67a6d9122105a62b25968984d980f06d503af9e;hb=3795aa29ab1e428e7060c39bc41daa4f796470ae;hp=79c77e06442e7aa080990769324f34d1a7be1921;hpb=5826dcea318c6f4e6cdaf4e43a5bf027bd895ee7;p=tools%2Fconfiguration.git diff --git a/cmake/SalomeMacros.cmake b/cmake/SalomeMacros.cmake index 79c77e0..e67a6d9 100644 --- a/cmake/SalomeMacros.cmake +++ b/cmake/SalomeMacros.cmake @@ -1,4 +1,4 @@ -# Copyright (C) 2012-2019 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2021 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -19,6 +19,18 @@ # Author: A.Geay, V. Sandler, A. Bruneton # +#---------------------------------------------------------------------------- +# Set-up global policies +#---------------------------------------------------------------------------- +CMAKE_POLICY(SET CMP0003 NEW) # Ensure proper linker behavior +IF(WIN32) + CMAKE_POLICY(SET CMP0020 OLD) # Disable automatic linking to qtmain.lib +ENDIF(WIN32) +CMAKE_POLICY(SET CMP0053 NEW) # For correct Qt 5 detection procedure +IF(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12) + CMAKE_POLICY(SET CMP0074 NEW) # Use ROOT variables when detecting packages +ENDIF() + #---------------------------------------------------------------------------- # LIST_CONTAINS is a macro useful for determining whether a list has a # particular entry @@ -321,11 +333,11 @@ MACRO(SALOME_PACKAGE_REPORT_AND_CHECK) ELSE() SET(_length 23) ENDIF() - MESSAGE(STATUS "") - MESSAGE(STATUS " Optional packages - Detection report ") - MESSAGE(STATUS " ==================================== ") - MESSAGE(STATUS "") IF(DEFINED _SALOME_OPTIONAL_PACKAGES_names) + MESSAGE(STATUS "") + MESSAGE(STATUS " Optional packages - Detection report ") + MESSAGE(STATUS " ==================================== ") + MESSAGE(STATUS "") LIST(LENGTH _SALOME_OPTIONAL_PACKAGES_names _list_len) # Another CMake stupidity - FOREACH(... RANGE r) generates r+1 numbers ... MATH(EXPR _range "${_list_len}-1") @@ -345,9 +357,9 @@ MACRO(SALOME_PACKAGE_REPORT_AND_CHECK) MESSAGE(STATUS " * ${_pkg_name} -> ${_found_msg}${_flag_msg}") ENDFOREACH() + MESSAGE(STATUS "") + MESSAGE(STATUS "") ENDIF(DEFINED _SALOME_OPTIONAL_PACKAGES_names) - MESSAGE(STATUS "") - MESSAGE(STATUS "") # Failure if some packages were missing: IF(_will_fail) @@ -573,12 +585,12 @@ MACRO(SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS pkg referenceVariable upCount) # Note the double de-reference of "referenceVariable": SET(_tmp_ROOT_DIR "${${referenceVariable}}") ENDIF() - # Up cound can be reset by detection procedure + # Up count can be reset by detection procedure SET(_upCount ${upCount}) IF(DEFINED ${pkg_UC}_UPCOUNT) SET(_upCount ${${pkg_UC}_UPCOUNT}) ENDIF() - IF(${_upCount}) + IF(${_upCount} GREATER 0) FOREACH(_unused RANGE 1 ${_upCount}) GET_FILENAME_COMPONENT(_tmp_ROOT_DIR "${_tmp_ROOT_DIR}" PATH) ENDFOREACH() @@ -747,8 +759,11 @@ MACRO(SALOME_ACCUMULATE_ENVIRONMENT envvar) IF(_is_check) IF(NOT IS_DIRECTORY ${_item}) IF(TARGET ${_item}) - GET_TARGET_PROPERTY(_item ${_item} LOCATION) - ENDIF() + GET_TARGET_PROPERTY(_target_type ${_item} TYPE) + IF(NOT ${_target_type} STREQUAL "INTERFACE_LIBRARY") + GET_TARGET_PROPERTY(_item ${_item} LOCATION) + ENDIF() + ENDIF() GET_FILENAME_COMPONENT(_item ${_item} PATH) ENDIF() IF(EXISTS ${_item})