cmake: Added project tests
This commit is contained in:
parent
2b44b4be9f
commit
bf81aac465
|
@ -553,6 +553,7 @@ def skip_csharp(backend):
|
||||||
def detect_tests_to_run():
|
def detect_tests_to_run():
|
||||||
# Name, subdirectory, skip condition.
|
# Name, subdirectory, skip condition.
|
||||||
all_tests = [
|
all_tests = [
|
||||||
|
('cmake', 'cmake', not shutil.which('cmake')),
|
||||||
('common', 'common', False),
|
('common', 'common', False),
|
||||||
('warning-meson', 'warning', False),
|
('warning-meson', 'warning', False),
|
||||||
('failing-meson', 'failing', False),
|
('failing-meson', 'failing', False),
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
project('cmakeSubTest', ['cpp'])
|
project('cmakeSubTest', ['cpp'])
|
||||||
|
|
||||||
subproject('cmMod')
|
sub_pro = subproject('cmMod', method: 'cmake')
|
||||||
|
sub_dep = sub_pro.get_variable('cmModLib_dep')
|
||||||
|
|
||||||
exe1 = executable('main', ['main.cpp'])
|
exe1 = executable('main', ['main.cpp'], dependencies: [sub_dep])
|
||||||
test('test1', exe1)
|
test('test1', exe1)
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
usr/lib/libcmModLib.so
|
||||||
|
usr/bin/testEXE
|
|
@ -1,6 +1,17 @@
|
||||||
project('cmakeSubTest_advanced', ['cpp'])
|
project('cmakeSubTest_advanced', ['cpp'])
|
||||||
|
|
||||||
subproject('cmMod')
|
# Test the "normal" subproject call
|
||||||
|
sub_pro = subproject('cmMod')
|
||||||
|
sub_dep = sub_pro.get_variable('cmModLib_dep')
|
||||||
|
|
||||||
exe1 = executable('main', ['main.cpp'])
|
# Test the dependency shortcut
|
||||||
|
shortcut_dep = dependency('ttabadbneiobevn', fallback: ['cmMod', 'cmModLib_dep'])
|
||||||
|
|
||||||
|
# Build some files
|
||||||
|
exe1 = executable('main1', ['main.cpp'], dependencies: [sub_dep])
|
||||||
|
exe2 = executable('main2', ['main.cpp'], dependencies: [shortcut_dep])
|
||||||
test('test1', exe1)
|
test('test1', exe1)
|
||||||
|
test('test2', exe2)
|
||||||
|
|
||||||
|
# Test if we can also extract executables
|
||||||
|
test('test3', sub_pro.get_variable('testEXE'))
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#include "cmMod.hpp"
|
#include "cmMod.hpp"
|
||||||
|
#include <zlib.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
cmModClass::cmModClass(string foo) {
|
cmModClass::cmModClass(string foo) {
|
||||||
str = foo + " World";
|
str = foo + " World " + zlibVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
string cmModClass::getStr() const {
|
string cmModClass::getStr() const {
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <zlib.h>
|
||||||
#include "lib/cmMod.hpp"
|
#include "lib/cmMod.hpp"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
cmModClass obj("Hello (LIB TEST)");
|
cmModClass obj("Hello (LIB TEST)");
|
||||||
cout << obj.getStr() << endl;
|
cout << obj.getStr() << " ZLIB: " << zlibVersion() << endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue