Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR] CMake: make output directory configurable #2915

Open
IvanPysmenni opened this issue Mar 12, 2024 · 7 comments
Open

[FR] CMake: make output directory configurable #2915

IvanPysmenni opened this issue Mar 12, 2024 · 7 comments
Labels
Type: Enhancement Indicates new feature requests

Comments

@IvanPysmenni
Copy link

It would be nice to have a possibility to configure build output folder. Especially when srt added as subdirectory to CMake build and root CMake configure some specific folder for build output.

Something like this:

if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
    set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
endif()
if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
    set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
endif()
if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY
    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
endif()

Or create separate options for it like: SRT_RUNTIME_OUTPUT_DIRECTORY

@IvanPysmenni IvanPysmenni added the Type: Enhancement Indicates new feature requests label Mar 12, 2024
@ethouris
Copy link
Collaborator

Not sure what you want to achieve. The build directory is a temporary working place where intermediate files are stored. They are of no use to anything except making a target. To get all the compile targets where you wish them to be you should use the installation directory that you configure through CMAKE_INSTALL_PREFIX.

@IvanPysmenni
Copy link
Author

I may not want to use make install command. I just want to build and pack everything in debian package. Or for example after build but before installation I want execute unit test to check that everything is OK. I set up output dirtectory to every subproject to make sure that all dll's will be near execution file(unit test execution file).

@ethouris
Copy link
Collaborator

All final artifacts are being built in the main build directory. You select this directory yourself when you are making a build; this can be either the in-source build or a shadow build, in which case it's a directory of your choice. The UT application is also run there.

Projects that use debian packaging either do installation to a preselected directory according to the standards, or there's a dedicated debian build definition file. Note that the binary package is comprised of public headers and library files, and which are these, it's defined in the build definition file.

@IvanPysmenni
Copy link
Author

Artifacts are being built to a directory that are specified by this variables: CMAKE_ARCHIVE_OUTPUT_DIRECTORY, CMAKE_LIBRARY_OUTPUT_DIRECTORY, CMAKE_RUNTIME_OUTPUT_DIRECTORY, CMAKE_PDB_OUTPUT_DIRECTORY
https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#output-artifacts

In srt this variables hardcoded to CMAKE_BINARY_DIR with no way to change it
https://github.com/Haivision/srt/blob/master/CMakeLists.txt#L248

@IvanPysmenni
Copy link
Author

IvanPysmenni commented Mar 12, 2024

For example if I want to build my project with srt and jsoncpp subprojects without specifying build output folder I will end up in complete mess in build folder. Because srt will save build artifacts to CMAKE_BINARY_DIR and jsoncpp will save to CMAKE_BINARY_DIR/bin and CMAKE_BINARY_DIR/lib. In this case where I should save UT?
https://github.com/open-source-parsers/jsoncpp/blob/master/CMakeLists.txt#L100

In case of jsoncpp I have a possibility to change build output folder but not in srt case

@ethouris
Copy link
Collaborator

Ah, ok. So the request is to just not overwrite these directories if they are set to any values prior to call the cmake?

@IvanPysmenni
Copy link
Author

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Indicates new feature requests
Projects
None yet
Development

No branches or pull requests

2 participants