I
I
Ilya2018-07-01 14:28:57
C++ / C#
Ilya, 2018-07-01 14:28:57

How to work with an ide for a build of all sources with one command?

Hello.
The question is how to set up an IDE (in particular clion) for compiling programs so that the resulting files end up in the same directory.
So, I have a program that interacts with watchdog.
This program looks for the watchdog executable in the same directory as itself.
There are also several dlls that are located in another directory, which, in turn, is located in the same place as the executable files.
I would like to create this entire structure using one click on the build, and not copy many files manually.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ilya, 2018-07-14
@iliyapisany

The solution to the issue turned out to be in the cmake variables:
CMAKE_RUNTIME_OUTPUT_DIRECTORY, responsible for the directory where the result of add_executable will be placed specifically for THIS project, in which this variable was described
CMAKE_LIBRARY_OUTPUT_DIRECTORY, responsible for the library directory
CMAKE_ARCHIVE_OUTPUT_DERICTORY, responsible for library export files
For each CMakiLists.txt, the variables are different!
https://cmake.org/cmake/help/v3.0/prop_tgt/LIBRARY...
https://cmake.org/cmake/help/v3.0/prop_tgt/ARCHIVE...
https://cmake. org/cmake/help/v3.0/prop_tgt/RUNTIME...

A
Alexander Movchan, 2018-07-01
@Alexander1705

install

This program looks for the watchdog executable in the same directory as itself.
There are also several dlls that are located in another directory, which, in turn, is located in the same place as the executable files.

The program has no idea where it "lies" (unless there is some platform-specific toolkit). There is such a thing as a working directory , but it does not have to match the location of the program. In Clion, you can easily change this directory (edit configurations).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question