File tree Expand file tree Collapse file tree 6 files changed +79
-0
lines changed
Expand file tree Collapse file tree 6 files changed +79
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ # Automatically generated from tests/objective-c/cmake.toml - DO NOT EDIT
3+ layout : default
4+ title : Objective-C
5+ permalink : /examples/objective-c
6+ parent : Examples
7+ nav_order : 11
8+ ---
9+
10+ # Objective-C
11+
12+ Add Objective-C sources on Apple platforms:
13+
14+ ``` toml
15+ [project ]
16+ name = " objective-c"
17+ description = " Objective-C"
18+ languages = [" C" ]
19+ apple.languages = [" OBJC" ]
20+
21+ [target .hello ]
22+ type = " executable"
23+ sources = [" src/main.c" ]
24+ apple.sources = [" src/apple.m" ]
25+ apple.link-libraries = [" $<LINK_LIBRARY:FRAMEWORK,Foundation>" ]
26+ ```
27+
28+
29+
30+ <sup ><sub >This page was automatically generated from [ tests/objective-c/cmake.toml] ( https://github.com/build-cpp/cmkr/tree/main/tests/objective-c/cmake.toml ) .</sub ></sup >
Original file line number Diff line number Diff line change @@ -65,3 +65,9 @@ name = "relative-paths"
6565working-directory = " relative-paths"
6666command = " $<TARGET_FILE:cmkr>"
6767arguments = [" build" ]
68+
69+ [[test ]]
70+ name = " objective-c"
71+ working-directory = " objective-c"
72+ command = " $<TARGET_FILE:cmkr>"
73+ arguments = [" build" ]
Original file line number Diff line number Diff line change 1+ # Add Objective-C sources on Apple platforms:
2+
3+ [project ]
4+ name = " objective-c"
5+ description = " Objective-C"
6+ languages = [" C" ]
7+ apple.languages = [" OBJC" ]
8+
9+ [target .hello ]
10+ type = " executable"
11+ sources = [" src/main.c" ]
12+ apple.sources = [" src/apple.m" ]
13+ apple.link-libraries = [" $<LINK_LIBRARY:FRAMEWORK,Foundation>" ]
Original file line number Diff line number Diff line change 1+ #import < Foundation/Foundation.h>
2+
3+ void platform_specific () {
4+ NSFileHandle *stdout = [NSFileHandle fileHandleWithStandardOutput ];
5+ NSString *message = @" Hello from Objective-C!\n " ;
6+ [stdout writeData: [message dataUsingEncoding: NSUTF8StringEncoding] error: nil ];
7+ }
Original file line number Diff line number Diff line change 1+ #include <stdio.h>
2+
3+ #ifdef __APPLE__
4+ void platform_specific ();
5+ #else
6+ void platform_specific () {
7+ puts ("This is not an Apple platform." );
8+ }
9+ #endif
10+
11+ int main () {
12+ platform_specific ();
13+ return 0 ;
14+ }
You can’t perform that action at this time.
0 commit comments