Skip to content

Commit

Permalink
add demo for aoe_add_test() and aoe_add_example()
Browse files Browse the repository at this point in the history
  • Loading branch information
yarten committed Jan 13, 2024
1 parent 2a339f4 commit b9f32a1
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 2 deletions.
24 changes: 23 additions & 1 deletion 02-almost_full_example/modules/mod1/lib2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,30 @@ aoe_add_library(lib2
# Other3rdLibrary [... its components]
)

aoe_add_executable_test(lib2
# -------------------------------------------------------------
# Create an executable test target with one default source file.
#
# Default behaviors:
# - includes the 'include' directory under this file's root
# - add 'test/<target name>.cpp' as the source file,
# or 'test/<target name>-<case name>.cpp' as the source file if CASE is given
# - links the library target with the same name

aoe_add_test(lib2
DEPEND
proto2 # lib2's private dependencies will not be propagated to this target,
# if you need them, you should explicitly declare to depend on them.
)
aoe_add_test(lib2 CASE case1)

# -------------------------------------------------------------
# Create an executable example target with one default source file.
#
# Default behaviors:
# - includes the 'include' directory under this file's root
# - add 'example/<target name>.cpp' as the source file,
# or 'example/<target name>-<case name>.cpp' as the source file if CASE is given
# - links the library target with the same name

aoe_add_example(lib2)
aoe_add_example(lib2 CASE case1)
12 changes: 12 additions & 0 deletions 02-almost_full_example/modules/mod1/lib2/example/lib2-case1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// Created by yarten on 24-1-13.
//

#include <demo/lib2.h>

int main()
{
demo::Lib2 lib2("Example with case");
lib2.sayHello();
return 0;
}
12 changes: 12 additions & 0 deletions 02-almost_full_example/modules/mod1/lib2/example/lib2.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// Created by yarten on 24-1-13.
//

#include <demo/lib2.h>

int main()
{
demo::Lib2 lib2("Exmaple");
lib2.sayHello();
return 0;
}
12 changes: 12 additions & 0 deletions 02-almost_full_example/modules/mod1/lib2/test/lib2-case1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// Created by yarten on 24-1-13.
//

#include <demo/lib2.h>

int main()
{
demo::Lib2 lib2("Test with case");
lib2.sayHello();
return 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

int main()
{
demo::Lib2 lib2;
demo::Lib2 lib2("Test");
lib2.sayHello();

std::cout << std::endl << "proto2 is used in main():" << std::endl;
Expand Down

0 comments on commit b9f32a1

Please sign in to comment.