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.

4
  • 1
    Does this answer your question? Copy file from source directory to binary directory using CMake Commented Nov 19, 2019 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. Commented Nov 19, 2019 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. Commented Nov 19, 2019 at 12:59
  • 1
    This question likely answers your issue: stackoverflow.com/q/13429656/3987854 Commented Nov 19, 2019 at 13:01

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.