0

I am building a project with CMake but I am new to it, so is really hard to understand how to do that.

cmake_minimum_required(VERSION 3.5)

project(my_project)
find_package(Qt5Core)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_BUILD_TYPE Debug)

file(GLOB includeFiles
    "include/*.h"
    "include/*.hpp"
    "external_dependencies/*.h"
    "external_dependencies/*.hpp"
    )

file(GLOB sourceFiles
    "src/*.cpp"
    "external_dependencies/*.cpp"
    )

.................................

add_executable(
${PROJECT_NAME}
"qml/qml.qrc"
"src/my_project.cpp"
${includeFiles}
${sourceFiles}
)
add_executable(...) 
add_dependencies(...)
target_link_libraries(...)

I need to get the qml files as well in the building folder of the application, more precise where the executable is created.

I need the whole directory to be copied by once with qml files.

  • 1
    Does this answer your question? [Copy file from source directory to binary directory using CMake](https://stackoverflow.com/questions/34799916/copy-file-from-source-directory-to-binary-directory-using-cmake) – Kevin Nov 19 '19 at 12:38
  • I found earlier that, but the problem comes that they are copying just files, I need a whole directory to be copied by once, and the method suggested there does not work unfortunately. – no_name_to_display Nov 19 '19 at 12:57
  • That was not explained in your question... Please update your question to correctly state your problem. Consider including a [Minimal Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example). – Kevin Nov 19 '19 at 12:59
  • 1
    This question likely answers your issue: https://stackoverflow.com/q/13429656/3987854 – Kevin Nov 19 '19 at 13:01

1 Answers1

1

I think that I found the answer using the posts suggested and adapted; I am using the next following line:

file(COPY qml_file DESTINATION devel)

Not sure how this will work on further needs of the project but for now works fine. Thanks for the suggestions.

Kevin
  • 16,549
  • 8
  • 60
  • 74