File tree 6 files changed +64
-0
lines changed
6 files changed +64
-0
lines changed Original file line number Diff line number Diff line change
1
+ CMakeCache.txt
2
+ CMakeFiles
3
+ cmake_install.cmake
4
+ ** /CMakeFiles /
5
+ ** /cmake_install.cmake
6
+ Makefile
7
+ CMakeHelloWorld
8
+ * .a
9
+ ** /* .a
10
+ build /**
Original file line number Diff line number Diff line change
1
+ cmake_minimum_required (VERSION 2.8)
2
+ project (CMakeHelloWorld)
3
+
4
+ #version number
5
+ set (CMakeHelloWorld_VERSION_MAJOR 1)
6
+ set (CMakeHelloWorld_VERSION_MINOR 0)
7
+
8
+ #include the subdirectory containing our libs
9
+ add_subdirectory (Hello)
10
+ include_directories (Hello)
11
+ #indicate the entry point for the executable
12
+ add_executable (CMakeHelloWorld Hello HelloWorld.cpp)
13
+
14
+ # Indicate which libraries to include during the link process.
15
+ target_link_libraries (CMakeHelloWorld Hello)
16
+
17
+ install (TARGETS CMakeHelloWorld DESTINATION bin)
Original file line number Diff line number Diff line change
1
+ add_library (Hello
2
+ Speaker.h
3
+ Speaker.cpp)
4
+
5
+ install (TARGETS Hello DESTINATION bin)
6
+ install (FILES Speaker.h DESTINATION include )
Original file line number Diff line number Diff line change
1
+ #include " Speaker.h"
2
+
3
+ using namespace Hello ;
4
+ using namespace std ;
5
+
6
+ namespace Hello {
7
+ void Speaker::sayHello () {
8
+ cout << " Hello, world!\n " ;
9
+ }
10
+ }
Original file line number Diff line number Diff line change
1
+ #include < stdio.h>
2
+ #include < iostream>
3
+
4
+ namespace Hello {
5
+
6
+ class Speaker {
7
+
8
+ public:
9
+ void sayHello ();
10
+ };
11
+ }
Original file line number Diff line number Diff line change
1
+ #include < Speaker.h>
2
+
3
+ using namespace std ;
4
+ using namespace Hello ;
5
+
6
+ int main (int argc, char *argv[]) {
7
+ Speaker* speaker = new Speaker ();
8
+
9
+ speaker->sayHello ();
10
+ }
You can’t perform that action at this time.
0 commit comments