Skip to content

Commit

Permalink
Fix for cmake 3.10 (eg on Ubuntu LTS) (#2632)
Browse files Browse the repository at this point in the history
CMAKE_PROJECT_VERSION is only predefined on cmake 3.12 and later,
so the previous code produced an empty version number which leads
to parsing errors when emcc checks the version.

Use of the older PROJECT_VERSION variable as the source of the
original version works here, as there's only one toplevel project
defined.
  • Loading branch information
bvibber committed Jan 30, 2020
1 parent 9384ff6 commit cd8d829
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -24,7 +24,7 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
if(${GIT_VERSION_RESULT})
message(WARNING "Error running git describe to determine version")
else()
set(CMAKE_PROJECT_VERSION "${CMAKE_PROJECT_VERSION} (${GIT_VERSION})")
set(PROJECT_VERSION "${PROJECT_VERSION} (${GIT_VERSION})")
endif()
endif()

Expand Down
2 changes: 1 addition & 1 deletion config.h.in
@@ -1 +1 @@
#cmakedefine CMAKE_PROJECT_VERSION "${CMAKE_PROJECT_VERSION}"
#cmakedefine PROJECT_VERSION "${PROJECT_VERSION}"
2 changes: 1 addition & 1 deletion src/support/command-line.cpp
Expand Up @@ -58,7 +58,7 @@ Options::Options(const std::string& command, const std::string& description)
"Output version information and exit",
Arguments::Zero,
[command](Options*, const std::string&) {
std::cout << command << " version " << CMAKE_PROJECT_VERSION << "\n";
std::cout << command << " version " << PROJECT_VERSION << "\n";
exit(0);
});
add("--help",
Expand Down

0 comments on commit cd8d829

Please sign in to comment.