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

Fixed CMake warnings #483

Merged
merged 3 commits into from
Aug 9, 2015
Merged

Fixed CMake warnings #483

merged 3 commits into from
Aug 9, 2015

Conversation

mkoval
Copy link
Collaborator

@mkoval mkoval commented Aug 4, 2015

This pull request sets the CMP0042 policy in CMake:

MACOSX_RPATH is enabled by default.

CMake 2.8.12 and newer has support for using @rpath in a target’s install name. This was enabled by setting the target property MACOSX_RPATH. The @rpath in an install name is a more flexible and powerful mechanism than @executable_path or @loader_path for locating shared libraries.

CMake 3.0 and later prefer this property to be ON by default. Projects wanting @rpath in a target’s install name may remove any setting of the INSTALL_NAME_DIR and CMAKE_INSTALL_NAME_DIR variables.

This policy was introduced in CMake version 3.0. CMake version 3.0.2 warns when the policy is not set and uses OLD behavior. Use the cmake_policy command to set it to OLD or NEW explicitly.

Setting this explicitly suppresses a warning when building with CMake >= 3.0 on OS X. From what I can tell online, @rpath is strictly better than the other options, so it is also a good thing to enable.

I also noticed that CMake was warning about an unused @only flag option in configure_file. It appears that this flag is case-sensitive, so I changed it to uppercase.

@@ -2,6 +2,7 @@
# CMake settings
#===============================================================================
cmake_minimum_required(VERSION 2.8.6 FATAL_ERROR)
cmake_policy(SET CMP0042 NEW)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems cmake less than 3.0.0 doesn't recognize this policy. There are some ways we can check if the policy is supported by the installed cmake. The second way looks good to me as:

if(POLICY CMP0042)
  # MACOSX_RPATH is enabled by default. This policy was introduced in CMake 3.0. 
  cmake_policy(SET CMP0042 NEW)
endif(POLICY CMP0042)

Travis-CI testing

@jslee02 jslee02 added this to the DART 5.1.0 milestone Aug 4, 2015
@mkoval
Copy link
Collaborator Author

mkoval commented Aug 8, 2015

I added the if(POLICY CMP0042) check. Hopefully Travis will be happy now. 😓

@jslee02
Copy link
Member

jslee02 commented Aug 9, 2015

Looks good to me 👍 Waiting for Travis to be happy.

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