Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 3, 2018, 1:43:20 AM (7 years ago)
Author:
landauf
Message:

with the latest CMake there are a lot of warnings about the usage of CMP0026. therefore the naming and content of the module/plugin-files had to be changed:
old: <library-filename>.module with content <target-name>
new: <target-name>.module with content <library-filename>
this seems to comply better with cmake and works equally well in c++ (with some small adjustments).
reference: https://cmake.org/cmake/help/v3.0/policy/CMP0026.html

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/cmake/tools/TargetUtilities.cmake

    r10716 r11692  
    469469
    470470
    471 # Creates a helper file with name <name_of_the_library>.<extension>
     471# Creates a helper file with name <target_name>.<extension> and content <filename_of_the_library>
    472472# This helps finding dynamically loadable modules or plugins at runtime
    473473
    474474FUNCTION(ADD_MODULE_OR_PLUGIN _target_name _output_dir _install_dir _extension)
    475   # We use the properties to get the name because the librarys name may differ from
    476   # the target name (for example orxonox <-> liborxonox)
    477   IF (POLICY CMP0026)
    478     CMAKE_POLICY(PUSH)
    479     CMAKE_POLICY(SET CMP0026 OLD) # we only use the file's name, not its actual location, so the old policy is fine
    480   ENDIF()
    481   GET_TARGET_PROPERTY(_target_loc ${_target_name} LOCATION)
    482   GET_FILENAME_COMPONENT(_target_filename ${_target_loc} NAME_WE)
    483   IF (POLICY CMP0026)
    484     CMAKE_POLICY(POP) # set policy back to original settings
    485   ENDIF()
    486475
    487476  IF(CMAKE_CONFIGURATION_TYPES)
    488477    FOREACH(_config ${CMAKE_CONFIGURATION_TYPES})
    489       SET(_helper_filename ${_output_dir}/${_config}/${_target_filename}${_extension})
    490 
    491       FILE(WRITE ${_helper_filename} ${_target_name})
     478      SET(_helper_filename ${_output_dir}/${_config}/${_target_name}${_extension})
     479
     480      FILE(GENERATE OUTPUT ${_helper_filename} CONTENT $<TARGET_FILE_NAME:${_target_name}>)
    492481
    493482      INSTALL(
     
    498487    ENDFOREACH()
    499488  ELSE()
    500     SET(_helper_filename ${_output_dir}/${_target_filename}${_extension})
    501 
    502     FILE(WRITE ${_helper_filename} ${_target_name})
     489    SET(_helper_filename ${_output_dir}/${_target_name}${_extension})
     490
     491    FILE(GENERATE OUTPUT ${_helper_filename} CONTENT $<TARGET_FILE_NAME:${_target_name}>)
    503492
    504493    INSTALL(
Note: See TracChangeset for help on using the changeset viewer.