CodeCompass
/
Exports.cmake
46 строк · 1.6 Кб
1#
2# Fetch some of the environment information that is necessary to run CodeCompass
3#
4
5# Transforms the given list of files to a list of their directory names.
6# The names are uniqued.
7# @parameter _outputName - The variable where the output
8# @parameter _fileList - The list of files to transform.
9function(filelist_to_dirlist_unique _outputName _fileList)
10list(APPEND _dirs "")
11foreach(_file IN LISTS _fileList)
12get_filename_component(_dir "${_file}" DIRECTORY)
13list(APPEND _dirs "${_dir}")
14endforeach()
15list(REMOVE_DUPLICATES _dirs)
16set(${_outputName} "${_dirs}" PARENT_SCOPE)
17endfunction(filelist_to_dirlist_unique)
18
19# Adds the given path to one of the paths that are exported to the install
20# location into an environment script.
21# @parameter _envVar - The variable to which the value should be exported.
22# @parameter _value - The value to export.
23function(mark_as_run_env_path _envVar _value)
24if (NOT RUNENV_${_envVar})
25set(_envList "${_value}")
26else()
27set(_envList "${RUNENV_${_envVar}}")
28list(APPEND _envList ${_value})
29endif()
30
31set(RUNENV_${_envVar} "${_envList}"
32CACHE INTERNAL "Environment variable exported to install." FORCE)
33mark_as_advanced(RUNENV_${_envVar})
34endfunction(mark_as_run_env_path)
35
36# Reset environment variables that were cached.
37set(RUNENV_LD_LIBRARY_PATH ""
38CACHE INTERNAL "Environment variable exported to install." FORCE)
39
40# ODB
41filelist_to_dirlist_unique(_odbLibDirs "${ODB_LIBRARIES}")
42mark_as_run_env_path(LD_LIBRARY_PATH "${_odbLibDirs}")
43
44# Thrift
45filelist_to_dirlist_unique(_thriftLibDirs "${THRIFT_LIBTHRIFT_LIBRARIES}")
46mark_as_run_env_path(LD_LIBRARY_PATH "${_thriftLibDirs}")
47