diff --git a/02-almost_full_example/modules/mod1/lib2/CMakeLists.txt b/02-almost_full_example/modules/mod1/lib2/CMakeLists.txt index cbb88dd..e818fc7 100644 --- a/02-almost_full_example/modules/mod1/lib2/CMakeLists.txt +++ b/02-almost_full_example/modules/mod1/lib2/CMakeLists.txt @@ -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/.cpp' as the source file, +# or 'test/-.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/.cpp' as the source file, +# or 'example/-.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) diff --git a/02-almost_full_example/modules/mod1/lib2/example/lib2-case1.cpp b/02-almost_full_example/modules/mod1/lib2/example/lib2-case1.cpp new file mode 100644 index 0000000..2c7b4d6 --- /dev/null +++ b/02-almost_full_example/modules/mod1/lib2/example/lib2-case1.cpp @@ -0,0 +1,12 @@ +// +// Created by yarten on 24-1-13. +// + +#include + +int main() +{ + demo::Lib2 lib2("Example with case"); + lib2.sayHello(); + return 0; +} diff --git a/02-almost_full_example/modules/mod1/lib2/example/lib2.cpp b/02-almost_full_example/modules/mod1/lib2/example/lib2.cpp new file mode 100644 index 0000000..c50a343 --- /dev/null +++ b/02-almost_full_example/modules/mod1/lib2/example/lib2.cpp @@ -0,0 +1,12 @@ +// +// Created by yarten on 24-1-13. +// + +#include + +int main() +{ + demo::Lib2 lib2("Exmaple"); + lib2.sayHello(); + return 0; +} diff --git a/02-almost_full_example/modules/mod1/lib2/test/lib2-case1.cpp b/02-almost_full_example/modules/mod1/lib2/test/lib2-case1.cpp new file mode 100644 index 0000000..4c2abeb --- /dev/null +++ b/02-almost_full_example/modules/mod1/lib2/test/lib2-case1.cpp @@ -0,0 +1,12 @@ +// +// Created by yarten on 24-1-13. +// + +#include + +int main() +{ + demo::Lib2 lib2("Test with case"); + lib2.sayHello(); + return 0; +} diff --git a/02-almost_full_example/modules/mod1/lib2/test/lib2/main.cpp b/02-almost_full_example/modules/mod1/lib2/test/lib2.cpp similarity index 90% rename from 02-almost_full_example/modules/mod1/lib2/test/lib2/main.cpp rename to 02-almost_full_example/modules/mod1/lib2/test/lib2.cpp index f5344dd..8ea7a6e 100644 --- a/02-almost_full_example/modules/mod1/lib2/test/lib2/main.cpp +++ b/02-almost_full_example/modules/mod1/lib2/test/lib2.cpp @@ -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;