Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to use wildcard in cmake install

I can install one specific file. When using wildcard in the same command, it complain the file does not exist.

This is the one that works

install(FILES  ${CMAKE_CURRENT_BINARY_DIR}/libproduction_rdict.pcm DESTINATION ${LIBRARY_OUTPUT_PATH})

This is the one not working

install(FILES  ${CMAKE_CURRENT_BINARY_DIR}/*_rdict.pcm DESTINATION ${LIBRARY_OUTPUT_PATH})

The error message is:

-- Install configuration: ""
CMake Error at Source/cmake_install.cmake:49 (file):
  file INSTALL cannot find
  "/home/wxie/AI/CUDA/cuda_exmaple/example_2/Build/Source/*_rdict.pcm".
Call Stack (most recent call first):
  cmake_install.cmake:42 (include)
like image 427
David Avatar asked Jul 02 '19 14:07

David


People also ask

What is Cmake_install Cmake?

As previous answer tells, the cmake_install. cmake contains the commands generated by install command from your CMakeLists. txt . You can execute it by cmake -P cmake_install. cmake and it performs the installation of your project even on windows.


1 Answers

Command flow install(FILES) requires all files to be listed explicitly.

For install several files by pattern, use install(DIRECTORY) and its PATTERN option:

install(DIRECTORY  ${CMAKE_CURRENT_BINARY_DIR} DESTINATION ${LIBRARY_OUTPUT_PATH}
    FILES_MATCHING PATTERN "*_rdict.pcm")

More information about install(DIRECTORY) and patterns can be found in documentation.

like image 132
Tsyvarev Avatar answered Oct 05 '22 15:10

Tsyvarev