-
Notifications
You must be signed in to change notification settings - Fork 29
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
Changes to support Mac OSX #270
base: master
Are you sure you want to change the base?
Conversation
This reverts commit c53f99d.
CMakeLists.txt
Outdated
@@ -197,6 +197,9 @@ cmake_policy(SET CMP0042 NEW) #MACOSX_RPATH is enabled by default | |||
#Windows 10 camplains | |||
cmake_policy(SET CMP0054 NEW) # quoted arguments will not be further dereferenced | |||
|
|||
#OSX complains | |||
cmake_policy(SET CMP0087 NEW) # evaluate generator expressions for install(CODE) and install(SCRIPT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Policy CMP0078 was defined in CMake version 3.13. As the minimum required version for building lomse is 2.8.10, any version lower than 3.13 generates an error:
CMake Error at CMakeLists.txt:208 (cmake_policy):
Policy "CMP0087" is not known to this version of CMake.
Please change to:
if (${CMAKE_VERSION} GREATER "3.12")
cmake_policy(SET CMP0078 NEW)
endif()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems you have added CMP0087
first and later changed it to CMP0078
?
Anyway, if your changes require the new behavior for this policy (namely, generator expressions support for install
), wouldn't this break things for earlier versions of CMake which don't have support for this feature included?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my change I've kept it as CMP0087 - expecting that 78 was a typo intended to be 87.
If I remember correctly, I only added that to prevent a warning so might not be critical.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmitrio95 You are right! I overlooked that a generator expression was introduced. I'm going to test this PR with cmake < 3.14 and also investigate the issue of the symlink commented by @grantsloman
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR tested. When using cmake version 3.10.2, as expected, the generator expression is not evaluated and the resulting command is
ln -fs /usr/local/lib/$<TARGET_FILE_NAME:lomse-shared> /usr/lib/liblomse.so
and fails to create the symlink. So it is clear that CMP0087 NEW behavior is not acceptable unless forcing to require a cmake >= 3.14
@grantsloman To try understand why the unpatched CMakeLists.txt
failed to create the symlink in macOS it would be useful to look at the generated command. And this is simple because in build folder cmake generates a file named "cmake_install.cmake"
. Please open it with a text editor and look for string "EXECUTE_PROCESS(COMMAND ln -fs"
. There is only one occurrence, around line 78, e.g. (when using cmake 3.10.2):
EXECUTE_PROCESS(COMMAND ln -fs /usr/local/lib/$<TARGET_FILE_NAME:lomse-shared>
/usr/local/lib/liblomse.so )
There you will see the ln
command and its arguments and you can try to find why it does not work for you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@grantsloman
A posible solution to supress fatal: No names found, cannot describe anything.
message is to add ERROR_QUIET
parameter to execute_command
:
execute_process(COMMAND "${GIT_EXECUTABLE}" describe --tags --long --dirty
WORKING_DIRECTORY "${LOMSE_ROOT_DIR}"
OUTPUT_VARIABLE LOMSE_VERSION_GIT
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET)
I have tested and it works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I change the CMakeLists.txt line back to
"EXECUTE_PROCESS(COMMAND ln -fs ${CMAKE_INSTALL_PREFIX}/lib/${LOMSE_SHARED}
${CMAKE_INSTALL_PREFIX}/lib/liblomse.so )"
then the resulting generated command in cmake_install.cmake
is
EXECUTE_PROCESS(COMMAND ln -fs /usr/local/lib/lomse-shared
/usr/local/lib/liblomse.so )
which isn't the correct target file name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've done some tests and, curiously, the symlink is always created even when removing these lines:
#create symlink to library
install( CODE
"EXECUTE_PROCESS(COMMAND ln -fs ${CMAKE_INSTALL_PREFIX}/lib/${LOMSE_SHARED}
${CMAKE_INSTALL_PREFIX}/lib/liblomse.so )"
)
Therefore it seems irrelevant if that command is correct or not, and can be removed.
It looks as if cmake automatically creates the library and the symlink at build time. You can find them in build folder. Please notice that the previous command does not create a symlink in build folder so it is automatically created by cmake. And both are copied to /usr/local/lib
at install time, and the symlink is adjusted to point to the installed library.
I have tested removing the previous lines from CMakeLists.txt and it works perfectly and the symlink is created at installation time.
I'm not been able to find any cmake documentation explaining this and confirming that symlinks are automatically created for libraries, but my tests suggest this. I am missing something?
@grantsloman Could you please test this, removing previous lines, in macOS?
A few changes for building & running on Mac OSX. WxWidgets tutorials 1 & 2 now build and run successfully. Further work is required to get wxMidi working for tutorials 3 & 4.
Also a few general Unix fixes for copying target libs & creating symbolic link.