Skip to content

Commit

Permalink
added code for version macro for code to check.
Browse files Browse the repository at this point in the history
  • Loading branch information
hariharan-devarajan committed Apr 29, 2024
1 parent 9bff68a commit 5766fdf
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ set(LIBTOOL_INTERFACE 2)
set(LIBTOOL_REVISION 3)
set(LIBTOOL_AGE 2)

set(GOTCHA_VERSION_MAJOR 1)
set(GOTCHA_VERSION_MINOR 0)
set(GOTCHA_VERSION_PATCH 6)

set(DEFAULT_SYMBOL_VISIBILITY hidden)

if(GOTCHA_ENABLE_TESTS)
Expand All @@ -22,6 +26,7 @@ if(GOTCHA_ENABLE_TESTS)
endif()
endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
include_directories(${CMAKE_BINARY_DIR}/include)
add_subdirectory(include)
add_subdirectory(src)
if(GOTCHA_ENABLE_TESTS)
Expand Down Expand Up @@ -50,3 +55,10 @@ configure_package_config_file(
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/gotcha-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/gotcha-config-version.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/gotcha")

# Write the configure file
configure_file("${CMAKE_SOURCE_DIR}/cmake/gotcha_config.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/include/gotcha/gotcha_config.h" @ONLY)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/include/gotcha/gotcha_config.h"
DESTINATION "${gotcha_INSTALL_INCLUDE_DIR}/gotcha/gotcha_config.h")
9 changes: 9 additions & 0 deletions cmake/gotcha_config.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef GOTCHA_CONFIG_HPP
#define GOTCHA_CONFIG_HPP

#define GOTCHA_VERSION_MAJOR "@GOTCHA_VERSION_MAJOR@"
#define GOTCHA_VERSION_MINOR "@GOTCHA_VERSION_MINOR@"
#define GOTCHA_VERSION_PATCH "@GOTCHA_VERSION_PATCH@"
#define GOTCHA_VERSION "@GOTCHA_VERSION_MAJOR@.@GOTCHA_VERSION_MINOR@.@GOTCHA_VERSION_PATCH@"

#endif /* HPC_AIO_CONFIG_H */
4 changes: 2 additions & 2 deletions include/gotcha/gotcha.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#ifndef GOTCHA_H
#define GOTCHA_H

#include <gotcha/gotcha_config.h>
#include <gotcha/gotcha_types.h>
#include <link.h>

#include "gotcha/gotcha_types.h"

#if defined(__cplusplus)
extern "C" {
#endif
Expand Down

0 comments on commit 5766fdf

Please sign in to comment.