-
Notifications
You must be signed in to change notification settings - Fork 872
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
[build] Allow using all GNU directories even if libdir is set #2450
Conversation
I don't think this build system change can provoke a sole timeout test to fail... |
What I have earlier found out about CMake's GNUInstallDirs was that it does have some sensible definition in case of Windows. Not sure if any installation definition is being generated by CMake in that case, but at least it has never been failing. Also in this description I can't see any problem found in the development or a build break due to this. Also the condition that you removed should remain there. If GNUInstallDirs are not to be used in case of |
Rebased on a stable tag. It seems master is failing on Linux. |
I just tried CMake+MSVC and it tries to install a library in
I disagree. The only (known) case you don't want the GNU or UNIX layout is when building for a Windows environment. If you really want a way to enable/disable GNU/UNIX output then it should be a separate option, not rely on |
AppVeyor reports errors with CMake
|
Odd, the CMakeLists.txt file only has 1354 lines. But I guess the real error is |
63421b7
to
9d69ffb
Compare
Technically I think a script should go in sbin. But this should be backward compatible. |
It seems that cmake doesn't automatically pick GNU dirs if they are available. So now I use a variable to tell whether GNU dirs are used and act accordingly. |
@lewk2 you might want to review the PR as well. |
Ok, what is needed from this installation is: On POSIX systems (including Mac) it should allow to install things in the "standard" location of /usr/local/[lib64,bin,share], unless there's a directory specified explicitly, in which case it should install in this very directory, as specified. The way how this directory is specified should remain unchanged. On Windows, I don't know, although the least that should be supported there is a possibility to create a package so that it can be installed manually. Also the installation directory should be able to be customized, although this isn't currently defined how to do it (that is, usually the procedure is that you run the CMake GUI and then override whatever variables you need). |
Added some more checks on the GNU dirs so it doesn't install things in / on Windows. The rest of the installation folders can be deduced for Windows targets to use the default directories (which can be changed with a CMake prefix). |
I guess we can't rely on the CMake documentation... |
Maybe this is true only on POSIX systems. |
It depends on the CMake version. So I added a variable to check that. I use the default directories when it's possible (and not overriden for cygwin). If not I use the old system. And if the variables are not found, I emit a message saying installation is not possible. One can still build the project in that case.
|
It looks like all targets are OK now. Only some timeouts during tests which I don't think is related to these changes. |
Review commentsDefault CMake config on Windows with MSVC defines the following CMake variables (valid both for master and this PR):
Trying to build the "install" target (wants to install to
|
That's only true when running with CMake 3.14 and above. The current minimum CMake version is 2.8.12. I just tried a fresh project with MSVC and not using |
It seems DESTINATION was only allowed to be omitted in 3.14 https://cmake.org/cmake/help/v3.14/command/install.html#targets vs https://cmake.org/cmake/help/v3.13/command/install.html#targets After that the install destination directories can be deduced.
It's possible to use GNUInstallDirs and allow the user to force some specific target folder. The values set by the user are not overriden in that case [1]: > If the includer does not define a value the above-shown default will be used > and the value will appear in the cache for editing by the user. With MSVC builds this doesn't change the default values used to install targets. [1] https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
We don't need to use CMAKE_INSTALL_BINDIR which is not defined when GNUInstallDirs is not used. Using "TYPE BIN" will have the same result and will automatically pick the same as CMAKE_INSTALL_BINDIR. https://cmake.org/cmake/help/latest/command/install.html#installing-files
It is implied by the target type: > For regular executables, static libraries and shared libraries, the > DESTINATION argument is not required. For these target types, when > DESTINATION is omitted, a default destination will be taken from the > appropriate variable from GNUInstallDirs, or set to a built-in default value > if that variable is not defined. https://cmake.org/cmake/help/v3.14/command/install.html#targets
It is implied by each target type (static and dynamic libraries here): > For regular executables, static libraries and shared libraries, the > DESTINATION argument is not required. For these target types, when > DESTINATION is omitted, a default destination will be taken from the > appropriate variable from GNUInstallDirs, or set to a built-in default value > if that variable is not defined. https://cmake.org/cmake/help/v3.14/command/install.html#targets
…lable It wouldn't make a lot of sense to expect pkg-config otherwise. We shouldn't install in CMAKE_INSTALL_LIBDIR if it's not set (it will install in /pkgconfig).
We shouldn't install in CMAKE_INSTALL_INCLUDEDIR if it's not set (it will install them in /srt).
Note that on Windows we may potentially allow the CMake minimum version to be higher - should that help. Only on Linux we need this 2.8.11 compatibility. |
We do force CMAKE_INSTALL_LIBDIR which makes srt not use any other of the GNU directories... Merged upstream: Haivision/srt#2450
We do force CMAKE_INSTALL_LIBDIR which makes srt not use any other of the GNU directories... Merged upstream: Haivision/srt#2450 (cherry picked from commit 055841e)
It's possible to use GNUInstallDirs and allow the user to force some specific
target folder. The values set by the user are not overriden in that case [1]:
According to the comment, the main goal is not to use GNU directories when
compiling with MSVC, so the MICROSOFT check should be enough.
[1] https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html