diff --git a/src/compile/CMakeLists.txt b/src/compile/CMakeLists.txt index 9d3d0159..d7d1d258 100644 --- a/src/compile/CMakeLists.txt +++ b/src/compile/CMakeLists.txt @@ -1,7 +1,7 @@ -set(target_name compile) - find_package(spdlog CONFIG REQUIRED) +set(target_name compile) + file(GLOB_RECURSE _srcs "src/*.cpp") file(GLOB_RECURSE _hdrs "include/*.hpp") diff --git a/src/compile/include/compile.hpp b/src/compile/include/compile.hpp index 774fdde6..dd169a80 100644 --- a/src/compile/include/compile.hpp +++ b/src/compile/include/compile.hpp @@ -1,19 +1,4 @@ #pragma once -#include -#include "compile_export.hpp" - -namespace compile { -namespace info { -/** - * \brief Get compile version string - * \return The distribution compile version provided. - */ -std::string_view COMPILE_EXPORT version() noexcept; - -/** - * \return A bool represents if it is debug distribution. - */ -bool COMPILE_EXPORT is_debug() noexcept; -} // namespace info -} // namespace compile +#include "distribution.hpp" +#include "git.h" diff --git a/src/compile/include/distribution.hpp b/src/compile/include/distribution.hpp new file mode 100644 index 00000000..6a6818cb --- /dev/null +++ b/src/compile/include/distribution.hpp @@ -0,0 +1,12 @@ +#pragma once + +#include "compile_export.hpp" + +namespace compile { +namespace distribution { +/** + * \return A bool represents if it is debug distribution. + */ +bool COMPILE_EXPORT is_debug() noexcept; +} // namespace distribution +} // namespace compile diff --git a/src/compile/src/compile.cpp b/src/compile/src/compile.cpp deleted file mode 100644 index f71b5e89..00000000 --- a/src/compile/src/compile.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "compile.hpp" - -#include "git.h" - -namespace compile { -namespace info { -std::string_view version() noexcept { - return git::ProjectVersion(); -} - -bool is_debug() noexcept { -#ifdef _DEBUG - return true; -#else - return false; -#endif -} - -} // namespace info -} // namespace compile diff --git a/src/compile/src/distribution.cpp b/src/compile/src/distribution.cpp new file mode 100644 index 00000000..029f5430 --- /dev/null +++ b/src/compile/src/distribution.cpp @@ -0,0 +1,13 @@ +#include "distribution.hpp" + +namespace compile { +namespace distribution { +bool is_debug() noexcept { +#ifdef _DEBUG + return true; +#else + return false; +#endif +} +} // namespace distribution +} // namespace compile diff --git a/src/compile/tests/CMakeLists.txt b/src/compile/tests/CMakeLists.txt index 5caf3ba6..c9b674ca 100644 --- a/src/compile/tests/CMakeLists.txt +++ b/src/compile/tests/CMakeLists.txt @@ -1,4 +1,5 @@ find_package(GTest CONFIG REQUIRED) + include(GoogleTest) file(GLOB files "*.cpp") diff --git a/src/compile/tests/test_compile.cpp b/src/compile/tests/test_compile.cpp index f6f8681c..b1e88882 100644 --- a/src/compile/tests/test_compile.cpp +++ b/src/compile/tests/test_compile.cpp @@ -1,16 +1,16 @@ #include #include "compile.hpp" -TEST(info, version) { - const auto version = compile::info::version(); - EXPECT_FALSE(version.empty()); +TEST(compile, version) { + const auto version = git_ProjectVersion(); + EXPECT_STRNE(version, ""); } -TEST(info, distribution) { - const auto is_debug = compile::info::is_debug(); +TEST(compile, distribution) { + const auto is_debug = compile::distribution::is_debug(); #ifdef _DEBUG - GTEST_ASSERT_TRUE(is_debug); + EXPECT_TRUE(is_debug); #else - GTEST_ASSERT_FALSE(is_debug); + EXPECT_FALSE(is_debug); #endif } diff --git a/src/exe/CMakeLists.txt b/src/exe/CMakeLists.txt index cf28d7c5..7e4d163b 100644 --- a/src/exe/CMakeLists.txt +++ b/src/exe/CMakeLists.txt @@ -1,9 +1,9 @@ +find_package(spdlog CONFIG REQUIRED) + # The private target will not be installed and only act as requirements for main # and tests internally set(target_name_private exe_private) -find_package(spdlog CONFIG REQUIRED) - add_library(${target_name_private} INTERFACE) target_include_interface_directories( diff --git a/src/exe/include/distribution.hpp b/src/exe/include/distribution.hpp new file mode 100644 index 00000000..7d42d599 --- /dev/null +++ b/src/exe/include/distribution.hpp @@ -0,0 +1,15 @@ +#pragma once + +#include + +namespace exe { +namespace distribution { +inline bool is_debug() noexcept { +#ifdef _DEBUG + return true; +#else + return false; +#endif +} +} // namespace distribution +} // namespace exe diff --git a/src/exe/include/helpers.hpp b/src/exe/include/helpers.hpp deleted file mode 100644 index e2d7b890..00000000 --- a/src/exe/include/helpers.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include - -namespace exe { -namespace helpers { -inline int some_fun() { - spdlog::info("Hello helpers!"); - return 0; -} -} // namespace helpers -} // namespace exe diff --git a/src/exe/src/main.cpp b/src/exe/src/main.cpp index e540534e..73a85170 100644 --- a/src/exe/src/main.cpp +++ b/src/exe/src/main.cpp @@ -1,9 +1,10 @@ #include +#include "distribution.hpp" #include "git.h" -#include "helpers.hpp" int main() { - spdlog::info("Get a returned value: {} ; Version: {}", exe::helpers::some_fun(), git::ProjectVersion()); + spdlog::info("Build Version: {}", git::ProjectVersion()); + spdlog::info("Distribution Type: {}", exe::distribution::is_debug() ? "Debug" : "Release"); return 0; } diff --git a/src/exe/tests/CMakeLists.txt b/src/exe/tests/CMakeLists.txt index ba2e87c9..f3e98bab 100644 --- a/src/exe/tests/CMakeLists.txt +++ b/src/exe/tests/CMakeLists.txt @@ -1,4 +1,5 @@ find_package(GTest CONFIG REQUIRED) + include(GoogleTest) file(GLOB files "*.cpp") diff --git a/src/exe/tests/test_exe.cpp b/src/exe/tests/test_exe.cpp new file mode 100644 index 00000000..f2f46033 --- /dev/null +++ b/src/exe/tests/test_exe.cpp @@ -0,0 +1,17 @@ +#include +#include "distribution.hpp" +#include "git.h" + +TEST(exe, version) { + const auto version = git_ProjectVersion(); + EXPECT_STRNE(version, ""); +} + +TEST(exe, distribution) { + const auto is_debug = exe::distribution::is_debug(); +#ifdef _DEBUG + EXPECT_TRUE(is_debug); +#else + EXPECT_FALSE(is_debug); +#endif +} diff --git a/src/exe/tests/test_exe_helper.cpp b/src/exe/tests/test_exe_helper.cpp deleted file mode 100644 index e0ba20f4..00000000 --- a/src/exe/tests/test_exe_helper.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include "helpers.hpp" - -TEST(exe_helpers, some_fun) { - const auto fun_ret = exe::helpers::some_fun(); - GTEST_ASSERT_EQ(0, fun_ret); -} diff --git a/src/header/CMakeLists.txt b/src/header/CMakeLists.txt index 8881ded7..b1cfdc90 100644 --- a/src/header/CMakeLists.txt +++ b/src/header/CMakeLists.txt @@ -1,7 +1,7 @@ -set(target_name header) - find_package(spdlog CONFIG REQUIRED) +set(target_name header) + add_library(${target_name} INTERFACE) target_include_interface_directories( diff --git a/src/header/include/header/distribution.hpp b/src/header/include/header/distribution.hpp new file mode 100644 index 00000000..7e11a0b8 --- /dev/null +++ b/src/header/include/header/distribution.hpp @@ -0,0 +1,13 @@ +#pragma once + +namespace header { +namespace distribution { +inline bool is_debug() noexcept { +#ifdef _DEBUG + return true; +#else + return false; +#endif +} +} // namespace distribution +} // namespace header diff --git a/src/header/include/header/header.hpp b/src/header/include/header/header.hpp index 37f06e4c..dd169a80 100644 --- a/src/header/include/header/header.hpp +++ b/src/header/include/header/header.hpp @@ -1,18 +1,4 @@ #pragma once -#include +#include "distribution.hpp" #include "git.h" - -namespace header { -namespace common { -inline int some_fun() { - spdlog::info("{}", git::ProjectVersion()); - return 0; -} - -const std::string_view const_string() { - spdlog::info("Calling {}", __FUNCTION__); - return "This is a header_only only const string"; -} -} // namespace common -} // namespace header diff --git a/src/header/tests/CMakeLists.txt b/src/header/tests/CMakeLists.txt index 93d1a4b9..226d8eb0 100644 --- a/src/header/tests/CMakeLists.txt +++ b/src/header/tests/CMakeLists.txt @@ -1,4 +1,5 @@ find_package(GTest CONFIG REQUIRED) + include(GoogleTest) file(GLOB files "*.cpp") diff --git a/src/header/tests/test_header.cpp b/src/header/tests/test_header.cpp index 182c6e73..57e6a9d0 100644 --- a/src/header/tests/test_header.cpp +++ b/src/header/tests/test_header.cpp @@ -1,12 +1,16 @@ #include #include "header/header.hpp" -TEST(common, some_fun) { - const auto fun_ret = header::common::some_fun(); - GTEST_ASSERT_EQ(0, fun_ret); +TEST(header, version) { + const auto version = git_ProjectVersion(); + EXPECT_STRNE(version, ""); } -TEST(common, const_string) { - const auto fun_ret = header::common::const_string(); - GTEST_ASSERT_GT(fun_ret.size(), 0); +TEST(header, distribution) { + const auto is_debug = header::distribution::is_debug(); +#ifdef _DEBUG + EXPECT_TRUE(is_debug); +#else + EXPECT_FALSE(is_debug); +#endif } diff --git a/template/src/[% if compile_target != '' %]{{ compile_target }}[% endif %]/CMakeLists.txt.jinja b/template/src/[% if compile_target != '' %]{{ compile_target }}[% endif %]/CMakeLists.txt.jinja index 45752d43..b16c67f9 100644 --- a/template/src/[% if compile_target != '' %]{{ compile_target }}[% endif %]/CMakeLists.txt.jinja +++ b/template/src/[% if compile_target != '' %]{{ compile_target }}[% endif %]/CMakeLists.txt.jinja @@ -1,7 +1,7 @@ -set(target_name {{ compile_target }}) - find_package(spdlog CONFIG REQUIRED) +set(target_name {{ compile_target }}) + file(GLOB_RECURSE _srcs "src/*.cpp") file(GLOB_RECURSE _hdrs "include/*.hpp") diff --git a/template/src/[% if compile_target != '' %]{{ compile_target }}[% endif %]/include/distribution.hpp.jinja b/template/src/[% if compile_target != '' %]{{ compile_target }}[% endif %]/include/distribution.hpp.jinja new file mode 100644 index 00000000..c38641b8 --- /dev/null +++ b/template/src/[% if compile_target != '' %]{{ compile_target }}[% endif %]/include/distribution.hpp.jinja @@ -0,0 +1,12 @@ +#pragma once + +#include "{{ compile_target }}_export.hpp" + +namespace {{ compile_target }} { +namespace distribution { +/** + * \return A bool represents if it is debug distribution. + */ +bool {{ compile_target|upper }}_EXPORT is_debug() noexcept; +} // namespace distribution +} // namespace {{ compile_target }} diff --git a/template/src/[% if compile_target != '' %]{{ compile_target }}[% endif %]/include/{{ compile_target }}.hpp.jinja b/template/src/[% if compile_target != '' %]{{ compile_target }}[% endif %]/include/{{ compile_target }}.hpp.jinja index 23688bd3..dd169a80 100644 --- a/template/src/[% if compile_target != '' %]{{ compile_target }}[% endif %]/include/{{ compile_target }}.hpp.jinja +++ b/template/src/[% if compile_target != '' %]{{ compile_target }}[% endif %]/include/{{ compile_target }}.hpp.jinja @@ -1,19 +1,4 @@ #pragma once -#include -#include "{{ compile_target }}_export.hpp" - -namespace {{ compile_target }} { -namespace info { -/** - * \brief Get {{ compile_target }} version string - * \return The distribution {{ compile_target }} version provided. - */ -std::string_view {{ compile_target|upper }}_EXPORT version() noexcept; - -/** - * \return A bool represents if it is debug distribution. - */ -bool {{ compile_target|upper }}_EXPORT is_debug() noexcept; -} // namespace info -} // namespace {{ compile_target }} +#include "distribution.hpp" +#include "git.h" diff --git a/template/src/[% if compile_target != '' %]{{ compile_target }}[% endif %]/src/distribution.cpp.jinja b/template/src/[% if compile_target != '' %]{{ compile_target }}[% endif %]/src/distribution.cpp.jinja new file mode 100644 index 00000000..deab27c0 --- /dev/null +++ b/template/src/[% if compile_target != '' %]{{ compile_target }}[% endif %]/src/distribution.cpp.jinja @@ -0,0 +1,13 @@ +#include "distribution.hpp" + +namespace {{ compile_target }} { +namespace distribution { +bool is_debug() noexcept { +#ifdef _DEBUG + return true; +#else + return false; +#endif +} +} // namespace distribution +} // namespace {{ compile_target }} diff --git a/template/src/[% if compile_target != '' %]{{ compile_target }}[% endif %]/src/{{ compile_target }}.cpp.jinja b/template/src/[% if compile_target != '' %]{{ compile_target }}[% endif %]/src/{{ compile_target }}.cpp.jinja deleted file mode 100644 index fa948265..00000000 --- a/template/src/[% if compile_target != '' %]{{ compile_target }}[% endif %]/src/{{ compile_target }}.cpp.jinja +++ /dev/null @@ -1,20 +0,0 @@ -#include "{{ compile_target }}.hpp" - -#include "git.h" - -namespace {{ compile_target }} { -namespace info { -std::string_view version() noexcept { - return git::ProjectVersion(); -} - -bool is_debug() noexcept { -#ifdef _DEBUG - return true; -#else - return false; -#endif -} - -} // namespace info -} // namespace {{ compile_target }} diff --git a/template/src/[% if compile_target != '' %]{{ compile_target }}[% endif %]/tests/CMakeLists.txt.jinja b/template/src/[% if compile_target != '' %]{{ compile_target }}[% endif %]/tests/CMakeLists.txt.jinja index 317f4c37..f5459d3d 100644 --- a/template/src/[% if compile_target != '' %]{{ compile_target }}[% endif %]/tests/CMakeLists.txt.jinja +++ b/template/src/[% if compile_target != '' %]{{ compile_target }}[% endif %]/tests/CMakeLists.txt.jinja @@ -1,4 +1,5 @@ find_package(GTest CONFIG REQUIRED) + include(GoogleTest) file(GLOB files "*.cpp") diff --git a/template/src/[% if compile_target != '' %]{{ compile_target }}[% endif %]/tests/test_{{ compile_target }}.cpp.jinja b/template/src/[% if compile_target != '' %]{{ compile_target }}[% endif %]/tests/test_{{ compile_target }}.cpp.jinja index 6723eabb..af63243b 100644 --- a/template/src/[% if compile_target != '' %]{{ compile_target }}[% endif %]/tests/test_{{ compile_target }}.cpp.jinja +++ b/template/src/[% if compile_target != '' %]{{ compile_target }}[% endif %]/tests/test_{{ compile_target }}.cpp.jinja @@ -1,16 +1,16 @@ #include #include "{{ compile_target }}.hpp" -TEST(info, version) { - const auto version = {{ compile_target }}::info::version(); - EXPECT_FALSE(version.empty()); +TEST({{ compile_target }}, version) { + const auto version = git_ProjectVersion(); + EXPECT_STRNE(version, ""); } -TEST(info, distribution) { - const auto is_debug = {{ compile_target }}::info::is_debug(); +TEST({{ compile_target }}, distribution) { + const auto is_debug = {{ compile_target }}::distribution::is_debug(); #ifdef _DEBUG - GTEST_ASSERT_TRUE(is_debug); + EXPECT_TRUE(is_debug); #else - GTEST_ASSERT_FALSE(is_debug); + EXPECT_FALSE(is_debug); #endif } diff --git a/template/src/[% if exe_target != '' %]{{ exe_target }}[% endif %]/CMakeLists.txt.jinja b/template/src/[% if exe_target != '' %]{{ exe_target }}[% endif %]/CMakeLists.txt.jinja index d4222fea..8630cca6 100644 --- a/template/src/[% if exe_target != '' %]{{ exe_target }}[% endif %]/CMakeLists.txt.jinja +++ b/template/src/[% if exe_target != '' %]{{ exe_target }}[% endif %]/CMakeLists.txt.jinja @@ -1,9 +1,9 @@ +find_package(spdlog CONFIG REQUIRED) + # The private target will not be installed and only act as requirements for main # and tests internally set(target_name_private {{ exe_target }}_private) -find_package(spdlog CONFIG REQUIRED) - add_library(${target_name_private} INTERFACE) target_include_interface_directories( diff --git a/template/src/[% if exe_target != '' %]{{ exe_target }}[% endif %]/include/distribution.hpp.jinja b/template/src/[% if exe_target != '' %]{{ exe_target }}[% endif %]/include/distribution.hpp.jinja new file mode 100644 index 00000000..a4238077 --- /dev/null +++ b/template/src/[% if exe_target != '' %]{{ exe_target }}[% endif %]/include/distribution.hpp.jinja @@ -0,0 +1,15 @@ +#pragma once + +#include + +namespace {{ exe_target }} { +namespace distribution { +inline bool is_debug() noexcept { +#ifdef _DEBUG + return true; +#else + return false; +#endif +} +} // namespace distribution +} // namespace {{ exe_target }} diff --git a/template/src/[% if exe_target != '' %]{{ exe_target }}[% endif %]/include/helpers.hpp.jinja b/template/src/[% if exe_target != '' %]{{ exe_target }}[% endif %]/include/helpers.hpp.jinja deleted file mode 100644 index a52e66ed..00000000 --- a/template/src/[% if exe_target != '' %]{{ exe_target }}[% endif %]/include/helpers.hpp.jinja +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include - -namespace {{ exe_target }} { -namespace helpers { -inline int some_fun() { - spdlog::info("Hello helpers!"); - return 0; -} -} // namespace helpers -} // namespace {{ exe_target }} diff --git a/template/src/[% if exe_target != '' %]{{ exe_target }}[% endif %]/src/main.cpp.jinja b/template/src/[% if exe_target != '' %]{{ exe_target }}[% endif %]/src/main.cpp.jinja index 746ed0b9..4ee0a195 100644 --- a/template/src/[% if exe_target != '' %]{{ exe_target }}[% endif %]/src/main.cpp.jinja +++ b/template/src/[% if exe_target != '' %]{{ exe_target }}[% endif %]/src/main.cpp.jinja @@ -1,9 +1,10 @@ #include +#include "distribution.hpp" #include "git.h" -#include "helpers.hpp" int main() { - spdlog::info("Get a returned value: {} ; Version: {}", {{ exe_target }}::helpers::some_fun(), git::ProjectVersion()); + spdlog::info("Build Version: {}", git::ProjectVersion()); + spdlog::info("Distribution Type: {}", {{ exe_target}}::distribution::is_debug() ? "Debug" : "Release"); return 0; } diff --git a/template/src/[% if exe_target != '' %]{{ exe_target }}[% endif %]/tests/CMakeLists.txt.jinja b/template/src/[% if exe_target != '' %]{{ exe_target }}[% endif %]/tests/CMakeLists.txt.jinja index 6f6c4e93..39b6e700 100644 --- a/template/src/[% if exe_target != '' %]{{ exe_target }}[% endif %]/tests/CMakeLists.txt.jinja +++ b/template/src/[% if exe_target != '' %]{{ exe_target }}[% endif %]/tests/CMakeLists.txt.jinja @@ -1,4 +1,5 @@ find_package(GTest CONFIG REQUIRED) + include(GoogleTest) file(GLOB files "*.cpp") diff --git a/template/src/[% if exe_target != '' %]{{ exe_target }}[% endif %]/tests/test_{{ exe_target }}.cpp.jinja b/template/src/[% if exe_target != '' %]{{ exe_target }}[% endif %]/tests/test_{{ exe_target }}.cpp.jinja new file mode 100644 index 00000000..ee52fc15 --- /dev/null +++ b/template/src/[% if exe_target != '' %]{{ exe_target }}[% endif %]/tests/test_{{ exe_target }}.cpp.jinja @@ -0,0 +1,17 @@ +#include +#include "distribution.hpp" +#include "git.h" + +TEST({{ exe_target }}, version) { + const auto version = git_ProjectVersion(); + EXPECT_STRNE(version, ""); +} + +TEST({{ exe_target }}, distribution) { + const auto is_debug = {{ exe_target }}::distribution::is_debug(); +#ifdef _DEBUG + EXPECT_TRUE(is_debug); +#else + EXPECT_FALSE(is_debug); +#endif +} diff --git a/template/src/[% if exe_target != '' %]{{ exe_target }}[% endif %]/tests/test_{{ exe_target }}_helper.cpp.jinja b/template/src/[% if exe_target != '' %]{{ exe_target }}[% endif %]/tests/test_{{ exe_target }}_helper.cpp.jinja deleted file mode 100644 index 7dcf9b35..00000000 --- a/template/src/[% if exe_target != '' %]{{ exe_target }}[% endif %]/tests/test_{{ exe_target }}_helper.cpp.jinja +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include "helpers.hpp" - -TEST({{ exe_target }}_helpers, some_fun) { - const auto fun_ret = {{ exe_target }}::helpers::some_fun(); - GTEST_ASSERT_EQ(0, fun_ret); -} diff --git a/template/src/[% if header_target != '' %]{{ header_target }}[% endif %]/CMakeLists.txt.jinja b/template/src/[% if header_target != '' %]{{ header_target }}[% endif %]/CMakeLists.txt.jinja index 1eee2d87..371e0894 100644 --- a/template/src/[% if header_target != '' %]{{ header_target }}[% endif %]/CMakeLists.txt.jinja +++ b/template/src/[% if header_target != '' %]{{ header_target }}[% endif %]/CMakeLists.txt.jinja @@ -1,7 +1,7 @@ -set(target_name {{ header_target }}) - find_package(spdlog CONFIG REQUIRED) +set(target_name {{ header_target }}) + add_library(${target_name} INTERFACE) target_include_interface_directories( diff --git a/template/src/[% if header_target != '' %]{{ header_target }}[% endif %]/include/{{ header_target }}/distribution.hpp.jinja b/template/src/[% if header_target != '' %]{{ header_target }}[% endif %]/include/{{ header_target }}/distribution.hpp.jinja new file mode 100644 index 00000000..6d95e3a8 --- /dev/null +++ b/template/src/[% if header_target != '' %]{{ header_target }}[% endif %]/include/{{ header_target }}/distribution.hpp.jinja @@ -0,0 +1,13 @@ +#pragma once + +namespace {{ header_target }} { +namespace distribution { +inline bool is_debug() noexcept { +#ifdef _DEBUG + return true; +#else + return false; +#endif +} +} // namespace distribution +} // namespace {{ header_target }} diff --git a/template/src/[% if header_target != '' %]{{ header_target }}[% endif %]/include/{{ header_target }}/{{ header_target }}.hpp.jinja b/template/src/[% if header_target != '' %]{{ header_target }}[% endif %]/include/{{ header_target }}/{{ header_target }}.hpp.jinja index 09bbba9b..dd169a80 100644 --- a/template/src/[% if header_target != '' %]{{ header_target }}[% endif %]/include/{{ header_target }}/{{ header_target }}.hpp.jinja +++ b/template/src/[% if header_target != '' %]{{ header_target }}[% endif %]/include/{{ header_target }}/{{ header_target }}.hpp.jinja @@ -1,18 +1,4 @@ #pragma once -#include +#include "distribution.hpp" #include "git.h" - -namespace {{ header_target }} { -namespace common { -inline int some_fun() { - spdlog::info("{}", git::ProjectVersion()); - return 0; -} - -const std::string_view const_string() { - spdlog::info("Calling {}", __FUNCTION__); - return "This is a header_only only const string"; -} -} // namespace common -} // namespace {{ header_target }} diff --git a/template/src/[% if header_target != '' %]{{ header_target }}[% endif %]/tests/CMakeLists.txt.jinja b/template/src/[% if header_target != '' %]{{ header_target }}[% endif %]/tests/CMakeLists.txt.jinja index d86ecc06..ea685c99 100644 --- a/template/src/[% if header_target != '' %]{{ header_target }}[% endif %]/tests/CMakeLists.txt.jinja +++ b/template/src/[% if header_target != '' %]{{ header_target }}[% endif %]/tests/CMakeLists.txt.jinja @@ -1,4 +1,5 @@ find_package(GTest CONFIG REQUIRED) + include(GoogleTest) file(GLOB files "*.cpp") diff --git a/template/src/[% if header_target != '' %]{{ header_target }}[% endif %]/tests/test_{{ header_target }}.cpp.jinja b/template/src/[% if header_target != '' %]{{ header_target }}[% endif %]/tests/test_{{ header_target }}.cpp.jinja index 89566ae2..9c27ac84 100644 --- a/template/src/[% if header_target != '' %]{{ header_target }}[% endif %]/tests/test_{{ header_target }}.cpp.jinja +++ b/template/src/[% if header_target != '' %]{{ header_target }}[% endif %]/tests/test_{{ header_target }}.cpp.jinja @@ -1,12 +1,16 @@ #include #include "{{ header_target }}/{{ header_target }}.hpp" -TEST(common, some_fun) { - const auto fun_ret = {{ header_target }}::common::some_fun(); - GTEST_ASSERT_EQ(0, fun_ret); +TEST({{ header_target }}, version) { + const auto version = git_ProjectVersion(); + EXPECT_STRNE(version, ""); } -TEST(common, const_string) { - const auto fun_ret = {{ header_target }}::common::const_string(); - GTEST_ASSERT_GT(fun_ret.size(), 0); +TEST({{ header_target }}, distribution) { + const auto is_debug = {{ header_target }}::distribution::is_debug(); +#ifdef _DEBUG + EXPECT_TRUE(is_debug); +#else + EXPECT_FALSE(is_debug); +#endif } diff --git a/template/vcpkg.json.jinja b/template/vcpkg.json.jinja index a2e0cb39..e75bc38a 100644 --- a/template/vcpkg.json.jinja +++ b/template/vcpkg.json.jinja @@ -39,7 +39,7 @@ [%- endif %] { "name": "cmake-modules", - "version": "1.4.30" + "version": "1.4.31" }, { "name": "robotology-cmake-ycm", @@ -61,7 +61,7 @@ "registries": [ { "kind": "git", - "baseline": "09e3f68327edeca50acbc3ebfe6fc21a2e467d34", + "baseline": "63d97f1471f276912352d5f3a3d777b61f868ac9", "repository": "https://github.com/msclock/cmake-registry", "packages": [ [%- if use_conan == true %] diff --git a/vcpkg.json b/vcpkg.json index 08338de3..4c1484cc 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -16,7 +16,7 @@ }, { "name": "cmake-modules", - "version": "1.4.30" + "version": "1.4.31" }, { "name": "robotology-cmake-ycm", @@ -38,7 +38,7 @@ "registries": [ { "kind": "git", - "baseline": "09e3f68327edeca50acbc3ebfe6fc21a2e467d34", + "baseline": "63d97f1471f276912352d5f3a3d777b61f868ac9", "repository": "https://github.com/msclock/cmake-registry", "packages": [ "cmake-modules",