CMake and add test program command
<p>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?</p>

<p>For exemple this makefile:</p>

<pre><code>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
</code></pre>

<p>I made this CMakefile:</p>

<pre><code>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)
</code></pre>

<p>How can I have the make run function? or other custom function?</p>