Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMake file(INSTALL files DESTINATION dir) with symbolic links

Tags:

cmake

I am using FILE(INSTALL files) but some of the files are symbolic links. Can I tell CMake to dereference the symbolic link instead of creating a symbolic link on destination?

like image 407
André Puel Avatar asked Jul 14 '12 21:07

André Puel


People also ask

What does configure_depends do in CMake?

New in version 3.12: If the CONFIGURE_DEPENDS flag is specified, CMake will add logic to the main build system check target to rerun the flagged GLOB commands at build time. If any of the outputs change, CMake will regenerate the build system. We do not recommend using GLOB to collect a list of source files from your source tree.

What is CMake_PATH () command?

This command is dedicated to file and path manipulation requiring access to the filesystem. For other path manipulation, handling only syntactic aspects, have a look at cmake_path () command.

How do I name an output file in CMake?

A specific OUTPUT file may be named by at most one invocation of file (GENERATE) . Generated files are modified and their timestamp updated on subsequent cmake runs only if their content is changed. Note also that file (GENERATE) does not create the output file until the generation phase.

What happens if a file does not exist in CMake?

If a file does not exist it will be silently ignored. With TOUCH and TOUCH_NOCREATE the contents of an existing file will not be modified. Generate an output file for each build configuration supported by the current CMake Generator.


1 Answers

You can dereference the files programmatically before passing them to install(FILES ...):

set (_resolvedFiles "")
foreach (_file ${_files})
    get_filename_component(_resolvedFile "${_file}" REALPATH)
    list (APPEND _resolvedFiles "${_resolvedFile}")
endforeach()
install(FILES ${_resolvedFiles} DESTINATION ${_dest})
like image 100
sakra Avatar answered Sep 19 '22 10:09

sakra