From 585fb99f7b3b97ff18ad804c40e9557dea1d064b Mon Sep 17 00:00:00 2001 From: Adrian Kummerländer Date: Sun, 2 Mar 2014 12:02:23 +0100 Subject: Switched build system to cmake * cmake offers a more straight forward and easier understandable way of building this project --- CMakeLists.txt | 42 ++++++++++++++++++++++++++++++++++++++++++ Makefile | 46 ---------------------------------------------- 2 files changed, 42 insertions(+), 46 deletions(-) create mode 100644 CMakeLists.txt delete mode 100644 Makefile 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 -- cgit v1.2.3