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

Fix a bug that unexpectedly created library symlink #550

Merged
merged 2 commits into from
Mar 23, 2022

Conversation

tt4g
Copy link
Contributor

@tt4g tt4g commented Mar 23, 2022

There was a bug in CMake that created library symlink when the CMake target name and the generated library name were different, but the library symlink was created when the two names were the same.
This bug occurred when the generated library name (OUTPUT_NAME property) contained a CMake generator expression (e.g. OUTPUT_NAME=$<IF:$<PLATFORM_ID:Windows>,pqxx,pqxx-7.7>).
If the library symlink is created when two names are the same, the source and destination of the link will have the same name, resulting in a circular reference (e.g. libpqxx.a -> libpqxx.a).
Avoid unexpected creation of library symlink by comparing the CMake target name with the generated library name when evaluating CMake generator expressions.

There was a bug in CMake that created library symlink when the CMake target name and the generated library name were different, but the library symlink was created when the two names were the same.
This bug occurred when the generated library name (`OUTPUT_NAME` property) contained a CMake generator expression (e.g. `OUTPUT_NAME=$<IF:$<PLATFORM_ID:Windows>,pqxx,pqxx-7.7>`).
If the library symlink is created when two names are the same, the source and destination of the link will have the same name, resulting in a circular reference (e.g. `libpqxx.a -> libpqxx.a`).
Avoid unexpected creation of library symlink by comparing the CMake target name with the generated library name when evaluating CMake generator expressions.
@tt4g tt4g changed the title Fix a bug that unexpectedly created library symlink WIP: Fix a bug that unexpectedly created library symlink Mar 23, 2022
@tt4g tt4g changed the title WIP: Fix a bug that unexpectedly created library symlink Fix a bug that unexpectedly created library symlink Mar 23, 2022
@tt4g
Copy link
Contributor Author

tt4g commented Mar 23, 2022

I have confirmed that it works on Ubuntu (Docker container) with GCC and MinGW (cross-compiled) as it did before the change.
Windows OS was not considered because it did not create symbolic link (by if(NOT CMAKE_HOST_WIN32)).

@jtv jtv merged commit 551d103 into jtv:master Mar 23, 2022
@jtv
Copy link
Owner

jtv commented Mar 23, 2022

Thanks very much for figuring this out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants