aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerländer2014-03-02 12:02:23 +0100
committerAdrian Kummerländer2014-03-02 12:02:23 +0100
commit585fb99f7b3b97ff18ad804c40e9557dea1d064b (patch)
tree6b4d1a77453d88b4d7ef98d56322f6a0a5c5b427
parent5b773d6a0ec801161f97fc5159d1f9c5a75c29c9 (diff)
downloadSimpleParser-585fb99f7b3b97ff18ad804c40e9557dea1d064b.tar
SimpleParser-585fb99f7b3b97ff18ad804c40e9557dea1d064b.tar.gz
SimpleParser-585fb99f7b3b97ff18ad804c40e9557dea1d064b.tar.bz2
SimpleParser-585fb99f7b3b97ff18ad804c40e9557dea1d064b.tar.lz
SimpleParser-585fb99f7b3b97ff18ad804c40e9557dea1d064b.tar.xz
SimpleParser-585fb99f7b3b97ff18ad804c40e9557dea1d064b.tar.zst
SimpleParser-585fb99f7b3b97ff18ad804c40e9557dea1d064b.zip
Switched build system to cmake
* cmake offers a more straight forward and easier understandable way of building this project
-rw-r--r--CMakeLists.txt42
-rw-r--r--Makefile46
2 files changed, 42 insertions, 46 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..06663a0
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,42 @@
+cmake_minimum_required(VERSION 2.8)
+project(SimpleParser)
+
+set(
+ CMAKE_CXX_FLAGS
+ "-std=c++11 -W -Wall -Wextra -Winline -pedantic"
+)
+
+add_library(
+ SimpleParser
+ SHARED
+ src/nodes.cc
+ src/tree.cc
+ src/utils.cc
+ src/parser.cc
+)
+
+add_executable(
+ test
+ test.cc
+)
+
+add_executable(
+ clc
+ clc.cc
+)
+
+target_link_libraries(
+ test
+ SimpleParser
+ gtest
+)
+
+target_link_libraries(
+ clc
+ SimpleParser
+)
+
+add_custom_command(
+ TARGET test
+ POST_BUILD COMMAND ./test
+)
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 560c151..0000000
--- a/Makefile
+++ /dev/null
@@ -1,46 +0,0 @@
-CXX = g++
-CXXFLAGS = -std=c++11 -W -Wall -Wextra -pedantic -fpic
-
-SRC_DIR = src
-BIN_DIR = bin
-
-LIB_SRC = $(SRC_DIR)/nodes.cc \
- $(SRC_DIR)/tree.cc \
- $(SRC_DIR)/utils.cc \
- $(SRC_DIR)/parser.cc
-LIB_OBJ = $(subst .cc,.o,$(LIB_SRC))
-
-TEST_SRC = test.cc
-CLC_SRC = clc.cc
-
-all: lib test clc
-
-lib: $(BIN_DIR)/libSimpleParser.so;
-test: $(BIN_DIR)/test;
-clc: $(BIN_DIR)/clc;
-
-$(BIN_DIR)/libSimpleParser.so: $(LIB_OBJ)
- $(CXX) -shared -o $(BIN_DIR)/libSimpleParser.so $(LIB_OBJ) $(CXXFLAGS)
-
-$(BIN_DIR)/test: $(BIN_DIR)/libSimpleParser.so
- $(CXX) -o $(BIN_DIR)/test $(TEST_SRC) -lgtest -L$(BIN_DIR)/ -lSimpleParser -std=c++11
- ./$(BIN_DIR)/test
-
-$(BIN_DIR)/clc: $(BIN_DIR)/libSimpleParser.so
- $(CXX) -o $(BIN_DIR)/clc $(CLC_SRC) -L$(BIN_DIR)/ -lSimpleParser -std=c++11
-
-install: $(BIN_DIR)/libSimpleParser.so $(BIN_DIR)/clc
- install -m 0755 $(BIN_DIR)/libSimpleParser.so /usr/lib
- install -m 0755 $(BIN_DIR)/clc /usr/bin
-
-.PHONY: clean;
-clean:
- rm -f $(LIB_OBJ)
- rm -f $(BIN_DIR)/*
-
-depend: .depend
-
-.depend: $(LIB_SRC)
- $(CXX) -M $(CXXFLAGS) $< > $@
-
-include .depend