Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

library build usign cmake

  • Loading branch information...
commit fd3a9effc076a2420e9b6be392e908857cdce74b 1 parent a60269a
@martin-etchart authored
View
5 librarybuilding/cmake/CMakeLists.txt
@@ -0,0 +1,5 @@
+project(demo_abc)
+cmake_minimum_required(VERSION 2.6)
+
+add_subdirectory(src)
+add_subdirectory(demo)
View
9 librarybuilding/cmake/demo/CMakeLists.txt
@@ -0,0 +1,9 @@
+project(demo_abc)
+cmake_minimum_required(VERSION 2.6)
+
+include_directories(../include)
+#link_directories(../lib)
+link_directories(../src)
+
+add_executable(demo_libabc demo_libabc.c)
+target_link_libraries(demo_libabc abc)
View
7 librarybuilding/cmake/demo/demo_libabc.c
@@ -0,0 +1,7 @@
+#include "libabc.h"
+
+int main(){
+ a_fun();
+ b_fun();
+ c_fun();
+}
View
3  librarybuilding/cmake/include/libabc.h
@@ -0,0 +1,3 @@
+void a_fun();
+void b_fun();
+void c_fun();
View
11 librarybuilding/cmake/src/CMakeLists.txt
@@ -0,0 +1,11 @@
+project(demo_abc)
+cmake_minimum_required(VERSION 2.6)
+
+
+#this part of the project generates the library
+add_library(abc a b c)
+
+# DOES NOT WORK DONT KNOW WHY
+#set(LIB_DIR ../lib/)
+#set_target_properties(abc PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${LIB_DIR}")
+
View
4 librarybuilding/cmake/src/a.c
@@ -0,0 +1,4 @@
+#include <stdio.h>
+void a_fun(){
+ printf("inside a_fun()\n");
+}
View
4 librarybuilding/cmake/src/b.c
@@ -0,0 +1,4 @@
+#include <stdio.h>
+void b_fun(){
+ printf("inside b_fun()\n");
+}
View
4 librarybuilding/cmake/src/c.c
@@ -0,0 +1,4 @@
+#include <stdio.h>
+void c_fun(){
+ printf("inside c_fun()\n");
+}
Please sign in to comment.
Something went wrong with that request. Please try again.