I use usually makefile for project but I want to start learn CMake. I use makefile not only for build my project but also to test my project. It's very useful. How can I do that with CMake?
For exemple this makefile:
pathword=words.txt
flags=-std=c++11 -Wall -Wextra -g -Og
#flags=-std=c++11 -O3 -DNDEBUG -s
default: TextMiningCompiler TextMiningApp
TextMiningCompiler: TextMiningCompiler.cpp trie.cpp
g++ $(flags) TextMiningCompiler.cpp trie.cpp -o TextMiningCompiler
TextMiningApp: TextMiningApp.cpp
g++ $(flags) TextMiningApp.cpp -o TextMiningApp
run: TextMiningCompiler TextMiningApp
./TextMiningCompiler $(pathword) totoro.txt
cat test.txt | time ./TextMiningApp totoro.txt
clean:
trash TextMiningCompiler TextMiningApp
I made this CMakefile:
cmake_minimum_required(VERSION 2.8.9)
project (TextMining)
add_executable(TextMiningApp TextMiningApp.cpp)
add_executable(TextMiningCompiler TextMiningCompiler.cpp trie.cpp read_words_file.cpp)
set_property(TARGET TextMiningApp PROPERTY CXX_STANDARD 11)
set_property(TARGET TextMiningCompiler PROPERTY CXX_STANDARD 11)
How can I have the make run function? or other custom function?