diff options
author | Brad King <brad.king@kitware.com> | 2019-11-14 15:31:18 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-11-14 15:57:42 (GMT) |
commit | d2e5e6ff1abec8b3b1579f122b7dcc89a35dbba4 (patch) | |
tree | 53e92d69536044321ac31d5543a6c426546b5aba /Tests/ObjC | |
parent | 786954c4893565d8da27329201fd235e347e051d (diff) | |
download | CMake-d2e5e6ff1abec8b3b1579f122b7dcc89a35dbba4.zip CMake-d2e5e6ff1abec8b3b1579f122b7dcc89a35dbba4.tar.gz CMake-d2e5e6ff1abec8b3b1579f122b7dcc89a35dbba4.tar.bz2 |
Tests: Organize Objective C/C++ test directories
Move them all under `Tests/ObjC` and `Tests/ObjCXX`.
Diffstat (limited to 'Tests/ObjC')
-rw-r--r-- | Tests/ObjC/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Tests/ObjC/c-file-extension-test/CMakeLists.txt | 5 | ||||
-rw-r--r-- | Tests/ObjC/c-file-extension-test/main.m | 8 | ||||
-rw-r--r-- | Tests/ObjC/cxx-file-extension-test/CMakeLists.txt | 8 | ||||
-rw-r--r-- | Tests/ObjC/cxx-file-extension-test/main.m | 8 | ||||
-rw-r--r-- | Tests/ObjC/objc-file-extension-test/CMakeLists.txt | 6 | ||||
-rw-r--r-- | Tests/ObjC/objc-file-extension-test/main.m | 12 | ||||
-rw-r--r-- | Tests/ObjC/simple-build-test/CMakeLists.txt | 11 | ||||
-rw-r--r-- | Tests/ObjC/simple-build-test/foo.h | 9 | ||||
-rw-r--r-- | Tests/ObjC/simple-build-test/foo.m | 7 | ||||
-rw-r--r-- | Tests/ObjC/simple-build-test/main.m | 12 |
11 files changed, 90 insertions, 0 deletions
diff --git a/Tests/ObjC/CMakeLists.txt b/Tests/ObjC/CMakeLists.txt new file mode 100644 index 0000000..ce3033c --- /dev/null +++ b/Tests/ObjC/CMakeLists.txt @@ -0,0 +1,4 @@ +ADD_TEST_MACRO(ObjC.simple-build-test simple-build-test) +ADD_TEST_MACRO(ObjC.c-file-extension-test c-file-extension-test) +ADD_TEST_MACRO(ObjC.cxx-file-extension-test cxx-file-extension-test) +ADD_TEST_MACRO(ObjC.objc-file-extension-test objc-file-extension-test) diff --git a/Tests/ObjC/c-file-extension-test/CMakeLists.txt b/Tests/ObjC/c-file-extension-test/CMakeLists.txt new file mode 100644 index 0000000..e091448 --- /dev/null +++ b/Tests/ObjC/c-file-extension-test/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.15) + +project(c-file-extension-test C) + +add_executable(c-file-extension-test main.m) diff --git a/Tests/ObjC/c-file-extension-test/main.m b/Tests/ObjC/c-file-extension-test/main.m new file mode 100644 index 0000000..1c159a9 --- /dev/null +++ b/Tests/ObjC/c-file-extension-test/main.m @@ -0,0 +1,8 @@ +#ifndef __OBJC__ +# error "Compiler cannot compile Objective-C" +#endif + +int main() +{ + return 0; +} diff --git a/Tests/ObjC/cxx-file-extension-test/CMakeLists.txt b/Tests/ObjC/cxx-file-extension-test/CMakeLists.txt new file mode 100644 index 0000000..eb065e4 --- /dev/null +++ b/Tests/ObjC/cxx-file-extension-test/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) + +project(cxx-file-extension-test) + +string(APPEND CMAKE_CXX_FLAGS " -std=c++11") +set(CMAKE_CXX_STANDARD 14) + +add_executable(cxx-file-extension-test main.m) diff --git a/Tests/ObjC/cxx-file-extension-test/main.m b/Tests/ObjC/cxx-file-extension-test/main.m new file mode 100644 index 0000000..1c159a9 --- /dev/null +++ b/Tests/ObjC/cxx-file-extension-test/main.m @@ -0,0 +1,8 @@ +#ifndef __OBJC__ +# error "Compiler cannot compile Objective-C" +#endif + +int main() +{ + return 0; +} diff --git a/Tests/ObjC/objc-file-extension-test/CMakeLists.txt b/Tests/ObjC/objc-file-extension-test/CMakeLists.txt new file mode 100644 index 0000000..27e88be --- /dev/null +++ b/Tests/ObjC/objc-file-extension-test/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.15) + +project(objc-file-extension-test OBJC CXX) + +add_executable(objc-file-extension-test main.m) +target_link_libraries(objc-file-extension-test "-framework Foundation") diff --git a/Tests/ObjC/objc-file-extension-test/main.m b/Tests/ObjC/objc-file-extension-test/main.m new file mode 100644 index 0000000..2ec3917 --- /dev/null +++ b/Tests/ObjC/objc-file-extension-test/main.m @@ -0,0 +1,12 @@ +#ifndef __OBJC__ +# error "Compiler is not an Objective-C compiler." +#endif + +#import <Foundation/Foundation.h> + +int main() +{ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + [pool release]; + return 0; +} diff --git a/Tests/ObjC/simple-build-test/CMakeLists.txt b/Tests/ObjC/simple-build-test/CMakeLists.txt new file mode 100644 index 0000000..5ab46ac --- /dev/null +++ b/Tests/ObjC/simple-build-test/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.15) + +set(CMAKE_MACOSX_RPATH OFF) + +project(simple-build-test OBJC) + +add_library(foo SHARED foo.m) +target_link_libraries(foo "-framework Foundation") + +add_executable(simple-build-test main.m) +target_link_libraries(simple-build-test "-framework Foundation" foo) diff --git a/Tests/ObjC/simple-build-test/foo.h b/Tests/ObjC/simple-build-test/foo.h new file mode 100644 index 0000000..b3fb084 --- /dev/null +++ b/Tests/ObjC/simple-build-test/foo.h @@ -0,0 +1,9 @@ +#import <Foundation/Foundation.h> + +@interface Foo : NSObject { + NSNumber* age; +} + +@property (nonatomic, retain) NSNumber* age; + +@end diff --git a/Tests/ObjC/simple-build-test/foo.m b/Tests/ObjC/simple-build-test/foo.m new file mode 100644 index 0000000..2d452a8 --- /dev/null +++ b/Tests/ObjC/simple-build-test/foo.m @@ -0,0 +1,7 @@ +#import "foo.h" + +@implementation Foo + +@synthesize age; + +@end diff --git a/Tests/ObjC/simple-build-test/main.m b/Tests/ObjC/simple-build-test/main.m new file mode 100644 index 0000000..970d554 --- /dev/null +++ b/Tests/ObjC/simple-build-test/main.m @@ -0,0 +1,12 @@ +#import <Foundation/Foundation.h> +#import "foo.h" + +int main(int argc, char **argv) +{ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + Foo *theFoo = [[Foo alloc] init]; + theFoo.age = [NSNumber numberWithInt:argc]; + NSLog(@"%d\n",[theFoo.age intValue]); + [pool release]; + return 0; +} |