summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2020-01-23 17:50:04 -0800
committerGitHub <noreply@github.com>2020-01-23 17:50:04 -0800
commit2132abdd621a354a25af6bc67d1bb603c6b3c4dc (patch)
treeb258d89ec3c653aac42ee82c8d7956994700052d /CMakeLists.txt
parent90cec44b193b95b71cf1ea34137cbf6e939b7144 (diff)
downloadwabt-2132abdd621a354a25af6bc67d1bb603c6b3c4dc.tar.gz
wabt-2132abdd621a354a25af6bc67d1bb603c6b3c4dc.tar.bz2
wabt-2132abdd621a354a25af6bc67d1bb603c6b3c4dc.zip
Remove build-time dependency on git (#1316)
Add VERSION to project command, which in turn required a cmake version bump to 3.0.0. Fixes: #1314
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt37
1 files changed, 19 insertions, 18 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 363a5660..1d98aa65 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,11 +14,28 @@
# limitations under the License.
#
-cmake_minimum_required(VERSION 2.6)
-project(WABT)
+cmake_minimum_required(VERSION 3.0.0)
+project(WABT VERSION 1.0.13)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
+# For git users, attempt to generate a more useful version string
+if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
+ find_package(Git QUIET REQUIRED)
+ execute_process(COMMAND
+ "${GIT_EXECUTABLE}" --git-dir=${CMAKE_CURRENT_SOURCE_DIR}/.git describe --tags
+ RESULT_VARIABLE
+ GIT_VERSION_RESULT
+ OUTPUT_VARIABLE
+ GIT_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if (${GIT_VERSION_RESULT})
+ message(WARNING "Error running git describe to determine version")
+ else ()
+ set(CMAKE_PROJECT_VERSION "${CMAKE_PROJECT_VERSION} (${GIT_VERSION})")
+ endif ()
+endif ()
+
option(BUILD_TESTS "Build GTest-based tests" ON)
option(USE_SYSTEM_GTEST "Use system GTest, instead of building" OFF)
option(BUILD_TOOLS "Build wabt commandline tools" ON)
@@ -69,22 +86,6 @@ include(CheckTypeSize)
check_type_size(ssize_t SSIZE_T)
check_type_size(size_t SIZEOF_SIZE_T)
-FIND_PACKAGE(Git QUIET REQUIRED)
-EXECUTE_PROCESS(COMMAND
- "${GIT_EXECUTABLE}" --git-dir=${CMAKE_CURRENT_SOURCE_DIR}/.git describe --tags
- RESULT_VARIABLE
- GIT_HASH_RESULT
- OUTPUT_VARIABLE
- GIT_HASH
- OUTPUT_STRIP_TRAILING_WHITESPACE)
-
-IF(${GIT_HASH_RESULT} EQUAL 0)
- SET(WABT_VERSION_INFO "${GIT_HASH}")
-ELSE()
- MESSAGE(WARNING "Error running git describe to determine version")
- SET(WABT_VERSION_INFO "(unable to determine version)")
-ENDIF()
-
configure_file(
${WABT_SOURCE_DIR}/src/config.h.in
${WABT_BINARY_DIR}/config.h