This commit is contained in:
2025-04-09 10:22:44 +02:00
commit 96ff5392c8
330 changed files with 28300 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
cmake_minimum_required(VERSION 3.28)
# define CXX interface library
# define target & alias (for other projects consuming the "source-tree")
add_library(iue-other_honly INTERFACE)
# define sources of target
target_sources(iue-other_honly
INTERFACE FILE_SET public_headers TYPE HEADERS BASE_DIRS ${PROJECT_SOURCE_DIR} FILES func.hpp func.detail.hpp)
# define installation step
install(TARGETS iue-other_honly EXPORT iue-other-export
FILE_SET public_headers DESTINATION "./")
# define test
if(BUILD_TESTING AND PROJECT_IS_TOP_LEVEL)
add_executable(iue-other_honly.test func.test.cpp)
target_link_libraries(iue-other_honly.test iue-other_honly)
add_test(NAME iue-other_honly.test COMMAND iue-other_honly.test)
endif()
# define CXX normal library
# define target & alias (for other projects consuming the "source-tree")
add_library(iue-other_lib)
# define sources of target
target_sources(iue-other_lib
PRIVATE library.cpp
PUBLIC FILE_SET public_headers TYPE HEADERS BASE_DIRS ${PROJECT_SOURCE_DIR} FILES library.hpp)
# define installation step
install(TARGETS iue-other_lib EXPORT iue-other-export
FILE_SET public_headers DESTINATION "./"
LIBRARY DESTINATION "./")
# define test
if(BUILD_TESTING AND PROJECT_IS_TOP_LEVEL)
add_executable(iue-other_lib.test library.test.cpp)
target_link_libraries(iue-other_lib.test iue-other_lib)
add_test(NAME iue-other_lib.test COMMAND iue-other_lib.test)
endif()
# export targets for consuming cmake projects
# generate and install a .cmake file to allow dependend projects consuming the "install-tree" to import all targets
install(EXPORT iue-other-export DESTINATION "iue-other" )
# allow dependend projects consuming the "build-tree" to use all targets
export(EXPORT iue-other-export)
+7
View File
@@ -0,0 +1,7 @@
#pragma once
namespace iue::other::detail {
inline int calc(int a) { return a * 2; }
} // namespace iue::other::detail
+9
View File
@@ -0,0 +1,9 @@
#pragma once
#include "func.detail.hpp"
namespace iue::other {
inline int header_only(int a) { return detail::calc(a); }
} // namespace iue::other
+9
View File
@@ -0,0 +1,9 @@
#include "iue-other/func.hpp"
#include <cassert> // assert
int main() {
assert(iue::other::header_only(5) == 10);
return 0;
}
+9
View File
@@ -0,0 +1,9 @@
#include "library.hpp"
namespace iue::other {
int Widget::calc() const { return 5; }
int calc(const Widget& w) { return w.calc(); }
} // namespace iue::other
+11
View File
@@ -0,0 +1,11 @@
#pragma once
namespace iue::other {
struct Widget {
int calc() const;
};
int calc(const Widget& w);
} // namespace iue::other
+12
View File
@@ -0,0 +1,12 @@
#include "iue-other/library.hpp"
#include <cassert> // assert
int main() {
auto w = iue::other::Widget();
assert(w.calc() == 5);
assert(iue::other::calc(w) == 5);
return 0;
}