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

Provide an explicit default CMAKE_BUILD_TYPE #3131

Merged
merged 3 commits into from
Jun 27, 2020

Conversation

masterleinad
Copy link
Contributor

Without this, we don't set any debug or optimization flags by default.
The actual default type is debatable but I think Release is an appropriate choice.

@crtrott
Copy link
Member

crtrott commented Jun 25, 2020

I assume this will not apply to Trilinos since its inside the not having set Project Name clause?

@masterleinad
Copy link
Contributor Author

I assume this will not apply to Trilinos since its inside the not having set Project Name clause?

Yes, that was the intention. I think it's not our business to do anything if Kokkos is just a subproject.

@dalg24 dalg24 requested a review from jjwilke June 25, 2020 16:35
CMakeLists.txt Outdated
@@ -83,6 +83,13 @@ IF(NOT KOKKOS_HAS_TRILINOS)
ENDif()
IF(NOT DEFINED ${PROJECT_NAME})
Copy link

Choose a reason for hiding this comment

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

Shouldn't this be

IF (NOT DEFINED PROJECT_NAME)

?

Copy link

@jjwilke jjwilke Jun 25, 2020

Choose a reason for hiding this comment

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

I realize this line already exists, but I think this is wrong. This line is 3 years old and somehow never got caught.

Copy link

Choose a reason for hiding this comment

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

This is obviously unrelated to the PR, per se, but should we fix it now?

@@ -83,6 +83,13 @@ IF(NOT KOKKOS_HAS_TRILINOS)
ENDif()
IF(NOT DEFINED ${PROJECT_NAME})
PROJECT(Kokkos CXX)
IF (NOT CMAKE_BUILD_TYPE)
Copy link

Choose a reason for hiding this comment

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

Would this better to check DEFINED CMAKE_BUILD_TYPE? There are uses for this being empty (i.e. CMake adds none of its own flags).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The purpose of this pull request was to default to something reasonable when no build type is provided when calling cmake.
If I check

IF(NOT DEFINED CMAKE_BUILD_TYPE)

I still get an empty build type in that case. In other words, CMAKE_BUILD_TYPE is already defined (as empty) at this point.

Copy link

Choose a reason for hiding this comment

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

Yep. I see the problem. See comment below.

SET(DEFAULT_BUILD_TYPE "Release")
MESSAGE(STATUS "Setting build type to '${DEFAULT_BUILD_TYPE}' as none was specified.")
SET(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE STRING
"Choose the type of build, options are: Debug, Release, RelWithDebInfo and MinSizeRel."
Copy link

Choose a reason for hiding this comment

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

Same question. If we only go here if build type has not been defined, we can just use a regular variable and don't need a cache variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This needs to be a CACHE variable to have any effect.

Copy link

Choose a reason for hiding this comment

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

Touché. This does get automatically defined in the CACHE even if not given on the command line. My bad.

dalg24
dalg24 previously requested changes Jun 26, 2020
Copy link
Member

@dalg24 dalg24 left a comment

Choose a reason for hiding this comment

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

Everything else look good.

CMakeLists.txt Outdated
PROJECT(Kokkos CXX)
IF (NOT CMAKE_BUILD_TYPE)
SET(DEFAULT_BUILD_TYPE "Release")
Copy link
Member

Choose a reason for hiding this comment

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

Please change to RelWithDebInfo

@dalg24 dalg24 dismissed their stale review June 27, 2020 03:23

Comment addressed

@dalg24 dalg24 merged commit 3b615a9 into kokkos:develop Jun 27, 2020
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.

None yet

4 participants