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

MCOL-939 Templating the version number header file with CMake. #321

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
MCOL-939 Templating the version number header file with CMake.
  • Loading branch information
drrtuy committed Nov 16, 2017
commit 01e74e67b02d997e96a27cf85230a29e3cc0b96c
1 change: 1 addition & 0 deletions CMakeLists.txt
Expand Up @@ -36,6 +36,7 @@ ENDIF(NOT CMAKE_BUILD_TYPE)

#set( CMAKE_VERBOSE_MAKEFILE on )

SET(TOP_SRC_DIR ${CMAKE_SOURCE_DIR})
INCLUDE(columnstore_version.cmake)

SET (PACKAGE columnstore)
Expand Down
10 changes: 5 additions & 5 deletions columnstore_version.cmake
@@ -1,16 +1,16 @@

# The CMakeLists.txt that includes this file must set ${TOP_SRC_DIR} variable beforehand.

# Generate "something" to trigger cmake rerun when VERSION changes
CONFIGURE_FILE(
${CMAKE_SOURCE_DIR}/VERSION
${CMAKE_BINARY_DIR}/VERSION.dep
${TOP_SRC_DIR}/VERSION
${TOP_SRC_DIR}/VERSION.dep
)

# Read value for a variable from VERSION.

MACRO(COLUMNSTORE_GET_CONFIG_VALUE keyword var)
IF(NOT ${var})
FILE (STRINGS ${CMAKE_SOURCE_DIR}/VERSION str REGEX "^[ ]*${keyword}=")
FILE (STRINGS ${TOP_SRC_DIR}/VERSION str REGEX "^[ ]*${keyword}=")
IF(str)
STRING(REPLACE "${keyword}=" "" str ${str})
STRING(REGEX REPLACE "[ ].*" "" str "${str}")
Expand Down Expand Up @@ -43,4 +43,4 @@ IF(NOT "${MAJOR_VERSION}" MATCHES "[0-9]+" OR
ENDMACRO()

# Get columnstore version
GET_COLUMNSTORE_VERSION()
GET_COLUMNSTORE_VERSION()
4 changes: 4 additions & 0 deletions dbcon/mysql/CMakeLists.txt
Expand Up @@ -21,6 +21,10 @@ SET ( libcalmysql_SRCS

add_definitions(-DMYSQL_DYNAMIC_PLUGIN)

SET(TOP_SRC_DIR "../../")
INCLUDE(../../columnstore_version.cmake)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/versionnumber.h.in ${CMAKE_CURRENT_SOURCE_DIR}/versionnumber.h)

set_source_files_properties(ha_calpont.cpp PROPERTIES COMPILE_FLAGS "-fno-rtti -fno-implicit-templates")

add_library(calmysql SHARED ${libcalmysql_SRCS})
Expand Down
8 changes: 0 additions & 8 deletions dbcon/mysql/versionnumber.h

This file was deleted.

8 changes: 8 additions & 0 deletions dbcon/mysql/versionnumber.h.in
@@ -0,0 +1,8 @@

#ifndef VERSIONNUMBER_H_
#define VERSIONNUMBER_H_
#include <string>
const std::string idb_version("${VERSION}");
const std::string idb_release("${PACKAGE_RELEASE}");
#endif