From 5766fdf80a581396795cb4f0a587969fcc19b0d7 Mon Sep 17 00:00:00 2001 From: hariharandev1 Date: Mon, 29 Apr 2024 15:57:58 -0700 Subject: [PATCH] added code for version macro for code to check. --- CMakeLists.txt | 12 ++++++++++++ cmake/gotcha_config.h.in | 9 +++++++++ include/gotcha/gotcha.h | 4 ++-- 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 cmake/gotcha_config.h.in diff --git a/CMakeLists.txt b/CMakeLists.txt index aaba856..5a90b72 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) @@ -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) @@ -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") \ No newline at end of file diff --git a/cmake/gotcha_config.h.in b/cmake/gotcha_config.h.in new file mode 100644 index 0000000..9495d7c --- /dev/null +++ b/cmake/gotcha_config.h.in @@ -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 */ diff --git a/include/gotcha/gotcha.h b/include/gotcha/gotcha.h index f46fec0..1180245 100644 --- a/include/gotcha/gotcha.h +++ b/include/gotcha/gotcha.h @@ -30,10 +30,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #ifndef GOTCHA_H #define GOTCHA_H +#include +#include #include -#include "gotcha/gotcha_types.h" - #if defined(__cplusplus) extern "C" { #endif