[mlpack-git] master: Add an option to disable CLI executables (9cd5bec)

gitdub at mlpack.org gitdub at mlpack.org
Sat Apr 16 08:16:38 EDT 2016


Repository : https://github.com/mlpack/mlpack
On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/cf2b62565078ffd3eb6c814bf37f286838afabae...28ae007678c8867122094fdf072793b227690404

>---------------------------------------------------------------

commit 9cd5bec89ca0d24e878944eddff1ee26313d84d4
Author: xantares <xantares09 at hotmail.com>
Date:   Fri Apr 15 09:33:00 2016 +0000

    Add an option to disable CLI executables
    
    the cmake option BUILD_CLI_EXECUTABLES is added


>---------------------------------------------------------------

9cd5bec89ca0d24e878944eddff1ee26313d84d4
 CMakeLists.txt                                     |  1 +
 src/mlpack/methods/CMakeLists.txt                  | 13 ++++++++
 src/mlpack/methods/adaboost/CMakeLists.txt         |  8 +----
 src/mlpack/methods/cf/CMakeLists.txt               |  8 +----
 src/mlpack/methods/decision_stump/CMakeLists.txt   |  9 ++----
 src/mlpack/methods/det/CMakeLists.txt              | 10 +-----
 src/mlpack/methods/emst/CMakeLists.txt             |  9 ++----
 src/mlpack/methods/fastmks/CMakeLists.txt          | 10 ++----
 src/mlpack/methods/gmm/CMakeLists.txt              | 28 ++--------------
 src/mlpack/methods/hmm/CMakeLists.txt              | 37 +++-------------------
 src/mlpack/methods/hoeffding_trees/CMakeLists.txt  |  9 ++----
 src/mlpack/methods/kernel_pca/CMakeLists.txt       |  9 ++----
 src/mlpack/methods/kmeans/CMakeLists.txt           |  9 +-----
 src/mlpack/methods/lars/CMakeLists.txt             |  8 +----
 .../methods/linear_regression/CMakeLists.txt       |  9 ++----
 .../methods/local_coordinate_coding/CMakeLists.txt |  9 ++----
 ...c_main.cpp => local_coordinate_coding_main.cpp} |  0
 .../methods/logistic_regression/CMakeLists.txt     |  9 ++----
 src/mlpack/methods/lsh/CMakeLists.txt              |  8 +----
 src/mlpack/methods/mean_shift/CMakeLists.txt       |  9 +-----
 src/mlpack/methods/mvu/CMakeLists.txt              |  9 ++----
 src/mlpack/methods/naive_bayes/CMakeLists.txt      |  9 ++----
 src/mlpack/methods/nca/CMakeLists.txt              |  8 +----
 src/mlpack/methods/neighbor_search/CMakeLists.txt  | 16 ++--------
 src/mlpack/methods/nmf/CMakeLists.txt              |  8 +----
 src/mlpack/methods/pca/CMakeLists.txt              |  9 ++----
 src/mlpack/methods/perceptron/CMakeLists.txt       |  9 +-----
 src/mlpack/methods/radical/CMakeLists.txt          |  9 ++----
 src/mlpack/methods/range_search/CMakeLists.txt     |  9 ++----
 src/mlpack/methods/rann/CMakeLists.txt             |  8 +----
 .../methods/softmax_regression/CMakeLists.txt      |  8 +----
 src/mlpack/methods/sparse_coding/CMakeLists.txt    |  9 ++----
 32 files changed, 64 insertions(+), 259 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 64ff308..6425ae2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,6 +11,7 @@ enable_cxx11()
 
 # First, define all the compilation options.
 # We default to debugging mode for developers.
+option(BUILD_CLI_EXECUTABLES "Build command-line executables" ON)
 option(DEBUG "Compile with debugging information" ON)
 option(PROFILE "Compile with profiling information" ON)
 option(ARMA_EXTRA_DEBUG "Compile with extra Armadillo debugging symbols." OFF)
diff --git a/src/mlpack/methods/CMakeLists.txt b/src/mlpack/methods/CMakeLists.txt
index be5dc80..7e2fa33 100644
--- a/src/mlpack/methods/CMakeLists.txt
+++ b/src/mlpack/methods/CMakeLists.txt
@@ -1,3 +1,16 @@
+
+macro (add_cli_executable name)
+if (BUILD_CLI_EXECUTABLES)
+  add_executable(mlpack_${name}
+    ${name}_main.cpp
+  )
+  target_link_libraries(mlpack_${name}
+    mlpack
+  )
+  install(TARGETS mlpack_${name} RUNTIME DESTINATION bin)
+endif ()
+endmacro ()
+
 # Recurse into each method mlpack provides.
 set(DIRS
   adaboost
diff --git a/src/mlpack/methods/adaboost/CMakeLists.txt b/src/mlpack/methods/adaboost/CMakeLists.txt
index 1a734dd..af2c59a 100644
--- a/src/mlpack/methods/adaboost/CMakeLists.txt
+++ b/src/mlpack/methods/adaboost/CMakeLists.txt
@@ -16,10 +16,4 @@ endforeach()
 # the parent scope).
 set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
 
-add_executable(mlpack_adaboost
-  adaboost_main.cpp
-)
-target_link_libraries(mlpack_adaboost
-  mlpack
-)
-install(TARGETS mlpack_adaboost RUNTIME DESTINATION bin)
+add_cli_executable (adaboost)
diff --git a/src/mlpack/methods/cf/CMakeLists.txt b/src/mlpack/methods/cf/CMakeLists.txt
index 5b3c777..30f5a4f 100644
--- a/src/mlpack/methods/cf/CMakeLists.txt
+++ b/src/mlpack/methods/cf/CMakeLists.txt
@@ -17,10 +17,4 @@ endforeach()
 # the parent scope).
 set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
 
-add_executable(mlpack_cf
-  cf_main.cpp
-)
-target_link_libraries(mlpack_cf
-  mlpack
-)
-install(TARGETS mlpack_cf RUNTIME DESTINATION bin)
+add_cli_executable (cf)
diff --git a/src/mlpack/methods/decision_stump/CMakeLists.txt b/src/mlpack/methods/decision_stump/CMakeLists.txt
index c485f70..c0cb4bb 100644
--- a/src/mlpack/methods/decision_stump/CMakeLists.txt
+++ b/src/mlpack/methods/decision_stump/CMakeLists.txt
@@ -16,10 +16,5 @@ endforeach()
 # the parent scope).
 set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
 
-add_executable(mlpack_decision_stump
-  decision_stump_main.cpp
-)
-target_link_libraries(mlpack_decision_stump
-  mlpack
-)
-install(TARGETS mlpack_decision_stump RUNTIME DESTINATION bin)
+add_cli_executable(decision_stump)
+
diff --git a/src/mlpack/methods/det/CMakeLists.txt b/src/mlpack/methods/det/CMakeLists.txt
index b356db7..73b0474 100644
--- a/src/mlpack/methods/det/CMakeLists.txt
+++ b/src/mlpack/methods/det/CMakeLists.txt
@@ -19,12 +19,4 @@ endforeach()
 # append sources (with directory name) to list of all mlpack sources (used at the parent scope)
 set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
 
-# executable
-add_executable(mlpack_det
-  det_main.cpp
-)
-# link dependencies of executable
-target_link_libraries(mlpack_det
-  mlpack
-)
-install(TARGETS mlpack_det RUNTIME DESTINATION bin)
+add_cli_executable(det)
diff --git a/src/mlpack/methods/emst/CMakeLists.txt b/src/mlpack/methods/emst/CMakeLists.txt
index 90817b9..dfcc332 100644
--- a/src/mlpack/methods/emst/CMakeLists.txt
+++ b/src/mlpack/methods/emst/CMakeLists.txt
@@ -21,10 +21,5 @@ endforeach()
 # the parent scope).
 set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
 
-add_executable(mlpack_emst
-  emst_main.cpp
-)
-target_link_libraries(mlpack_emst
-  mlpack
-)
-install(TARGETS mlpack_emst RUNTIME DESTINATION bin)
+add_cli_executable(emst)
+
diff --git a/src/mlpack/methods/fastmks/CMakeLists.txt b/src/mlpack/methods/fastmks/CMakeLists.txt
index e1524bb..9f7c8f5 100644
--- a/src/mlpack/methods/fastmks/CMakeLists.txt
+++ b/src/mlpack/methods/fastmks/CMakeLists.txt
@@ -19,10 +19,6 @@ endforeach()
 # the parent scope).
 set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
 
-add_executable(mlpack_fastmks
-  fastmks_main.cpp
-)
-target_link_libraries(mlpack_fastmks
-  mlpack
-)
-install(TARGETS mlpack_fastmks RUNTIME DESTINATION bin)
+add_cli_executable(fastmks)
+
+
diff --git a/src/mlpack/methods/gmm/CMakeLists.txt b/src/mlpack/methods/gmm/CMakeLists.txt
index 5587f99..e443cc2 100644
--- a/src/mlpack/methods/gmm/CMakeLists.txt
+++ b/src/mlpack/methods/gmm/CMakeLists.txt
@@ -21,28 +21,6 @@ endforeach()
 # the parent scope).
 set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
 
-# main executable, gmm
-add_executable(mlpack_gmm_train
-  gmm_train_main.cpp
-)
-
-# link dependencies of gmm
-target_link_libraries(mlpack_gmm_train
-  mlpack
-)
-
-add_executable(mlpack_gmm_generate
-  gmm_generate_main.cpp
-)
-target_link_libraries(mlpack_gmm_generate
-  mlpack
-)
-
-add_executable(mlpack_gmm_probability
-  gmm_probability_main.cpp
-)
-target_link_libraries(mlpack_gmm_probability
-  mlpack
-)
-
-install(TARGETS mlpack_gmm_train mlpack_gmm_generate mlpack_gmm_probability RUNTIME DESTINATION bin)
+add_cli_executable(gmm_train)
+add_cli_executable(gmm_generate)
+add_cli_executable(gmm_probability)
diff --git a/src/mlpack/methods/hmm/CMakeLists.txt b/src/mlpack/methods/hmm/CMakeLists.txt
index 6d1dbd0..245a2e5 100644
--- a/src/mlpack/methods/hmm/CMakeLists.txt
+++ b/src/mlpack/methods/hmm/CMakeLists.txt
@@ -18,37 +18,8 @@ endforeach()
 # the parent scope).
 set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
 
-add_executable(mlpack_hmm_train
-  hmm_train_main.cpp
-)
-target_link_libraries(mlpack_hmm_train
-  mlpack
-)
-
-add_executable(mlpack_hmm_loglik
-  hmm_loglik_main.cpp
-)
-target_link_libraries(mlpack_hmm_loglik
-  mlpack
-)
-
-add_executable(mlpack_hmm_viterbi
-  hmm_viterbi_main.cpp
-)
-target_link_libraries(mlpack_hmm_viterbi
-  mlpack
-)
-
-add_executable(mlpack_hmm_generate
-  hmm_generate_main.cpp
-)
-target_link_libraries(mlpack_hmm_generate
-  mlpack
-)
+add_cli_executable(hmm_train)
+add_cli_executable(hmm_loglik)
+add_cli_executable(hmm_viterbi)
+add_cli_executable(hmm_generate)
 
-install(TARGETS
-    mlpack_hmm_train
-    mlpack_hmm_loglik
-    mlpack_hmm_viterbi
-    mlpack_hmm_generate
-  RUNTIME DESTINATION bin)
diff --git a/src/mlpack/methods/hoeffding_trees/CMakeLists.txt b/src/mlpack/methods/hoeffding_trees/CMakeLists.txt
index 1420dbf..b43e193 100644
--- a/src/mlpack/methods/hoeffding_trees/CMakeLists.txt
+++ b/src/mlpack/methods/hoeffding_trees/CMakeLists.txt
@@ -26,10 +26,5 @@ endforeach()
 # the parent scope).
 set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
 
-add_executable(mlpack_hoeffding_tree
-  hoeffding_tree_main.cpp
-)
-target_link_libraries(mlpack_hoeffding_tree
-  mlpack
-)
-install(TARGETS mlpack_hoeffding_tree RUNTIME DESTINATION bin)
+add_cli_executable(hoeffding_tree)
+
diff --git a/src/mlpack/methods/kernel_pca/CMakeLists.txt b/src/mlpack/methods/kernel_pca/CMakeLists.txt
index 55f1cad..837aec7 100644
--- a/src/mlpack/methods/kernel_pca/CMakeLists.txt
+++ b/src/mlpack/methods/kernel_pca/CMakeLists.txt
@@ -16,10 +16,5 @@ set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
 
 add_subdirectory(kernel_rules)
 
-add_executable(mlpack_kernel_pca
-  kernel_pca_main.cpp
-)
-target_link_libraries(mlpack_kernel_pca
-  mlpack
-)
-install(TARGETS mlpack_kernel_pca RUNTIME DESTINATION bin)
+add_cli_executable(kernel_pca)
+
diff --git a/src/mlpack/methods/kmeans/CMakeLists.txt b/src/mlpack/methods/kmeans/CMakeLists.txt
index 168373c..2c3eafc 100644
--- a/src/mlpack/methods/kmeans/CMakeLists.txt
+++ b/src/mlpack/methods/kmeans/CMakeLists.txt
@@ -37,11 +37,4 @@ endforeach()
 # the parent scope).
 set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
 
-# The main K-Means executable.
-add_executable(mlpack_kmeans
-  kmeans_main.cpp
-)
-target_link_libraries(mlpack_kmeans
-  mlpack
-)
-install(TARGETS mlpack_kmeans RUNTIME DESTINATION bin)
+add_cli_executable(kmeans)
diff --git a/src/mlpack/methods/lars/CMakeLists.txt b/src/mlpack/methods/lars/CMakeLists.txt
index 00c72e2..938be8c 100644
--- a/src/mlpack/methods/lars/CMakeLists.txt
+++ b/src/mlpack/methods/lars/CMakeLists.txt
@@ -14,10 +14,4 @@ endforeach()
 # append sources (with directory name) to list of all mlpack sources (used at the parent scope)
 set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
 
-add_executable(mlpack_lars
-  lars_main.cpp
-)
-target_link_libraries(mlpack_lars
-  mlpack
-)
-install(TARGETS mlpack_lars RUNTIME DESTINATION bin)
+add_cli_executable(lars)
diff --git a/src/mlpack/methods/linear_regression/CMakeLists.txt b/src/mlpack/methods/linear_regression/CMakeLists.txt
index c4058d2..70270ae 100644
--- a/src/mlpack/methods/linear_regression/CMakeLists.txt
+++ b/src/mlpack/methods/linear_regression/CMakeLists.txt
@@ -15,10 +15,5 @@ endforeach()
 # the parent scope)
 set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
 
-add_executable(mlpack_linear_regression
-  linear_regression_main.cpp
-)
-target_link_libraries(mlpack_linear_regression
-  mlpack
-)
-install(TARGETS mlpack_linear_regression RUNTIME DESTINATION bin)
+add_cli_executable(linear_regression)
+
diff --git a/src/mlpack/methods/local_coordinate_coding/CMakeLists.txt b/src/mlpack/methods/local_coordinate_coding/CMakeLists.txt
index ca3495e..67db549 100644
--- a/src/mlpack/methods/local_coordinate_coding/CMakeLists.txt
+++ b/src/mlpack/methods/local_coordinate_coding/CMakeLists.txt
@@ -18,10 +18,5 @@ endforeach()
 # append sources (with directory name) to list of all mlpack sources (used at the parent scope)
 set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
 
-add_executable(mlpack_local_coordinate_coding
-  lcc_main.cpp
-)
-target_link_libraries(mlpack_local_coordinate_coding
-  mlpack
-)
-install(TARGETS mlpack_local_coordinate_coding RUNTIME DESTINATION bin)
+add_cli_executable(local_coordinate_coding)
+
diff --git a/src/mlpack/methods/local_coordinate_coding/lcc_main.cpp b/src/mlpack/methods/local_coordinate_coding/local_coordinate_coding_main.cpp
similarity index 100%
rename from src/mlpack/methods/local_coordinate_coding/lcc_main.cpp
rename to src/mlpack/methods/local_coordinate_coding/local_coordinate_coding_main.cpp
diff --git a/src/mlpack/methods/logistic_regression/CMakeLists.txt b/src/mlpack/methods/logistic_regression/CMakeLists.txt
index 5b384dc..50906c2 100644
--- a/src/mlpack/methods/logistic_regression/CMakeLists.txt
+++ b/src/mlpack/methods/logistic_regression/CMakeLists.txt
@@ -17,10 +17,5 @@ endforeach()
 # the parent scope)
 set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
 
-add_executable(mlpack_logistic_regression
-  logistic_regression_main.cpp
-)
-target_link_libraries(mlpack_logistic_regression
-  mlpack
-)
-install(TARGETS mlpack_logistic_regression RUNTIME DESTINATION bin)
+add_cli_executable(logistic_regression)
+
diff --git a/src/mlpack/methods/lsh/CMakeLists.txt b/src/mlpack/methods/lsh/CMakeLists.txt
index 4324100..3540e04 100644
--- a/src/mlpack/methods/lsh/CMakeLists.txt
+++ b/src/mlpack/methods/lsh/CMakeLists.txt
@@ -17,10 +17,4 @@ set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
 
 # The code to compute the approximate neighbor for the given query and reference
 # sets with p-stable LSH.
-add_executable(mlpack_lsh
-  lsh_main.cpp
-)
-target_link_libraries(mlpack_lsh
-  mlpack
-)
-install(TARGETS mlpack_lsh RUNTIME DESTINATION bin)
+add_cli_executable(lsh)
diff --git a/src/mlpack/methods/mean_shift/CMakeLists.txt b/src/mlpack/methods/mean_shift/CMakeLists.txt
index da74e0e..7e32c34 100644
--- a/src/mlpack/methods/mean_shift/CMakeLists.txt
+++ b/src/mlpack/methods/mean_shift/CMakeLists.txt
@@ -14,11 +14,4 @@ endforeach()
 # the parent scope).
 set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
 
-# The main K-Means executable.
-add_executable(mlpack_mean_shift
-  mean_shift_main.cpp
-)
-target_link_libraries(mlpack_mean_shift
-  mlpack
-)
-install(TARGETS mlpack_mean_shift RUNTIME DESTINATION bin)
+add_cli_executable(mean_shift)
diff --git a/src/mlpack/methods/mvu/CMakeLists.txt b/src/mlpack/methods/mvu/CMakeLists.txt
index a208a14..187b48e 100644
--- a/src/mlpack/methods/mvu/CMakeLists.txt
+++ b/src/mlpack/methods/mvu/CMakeLists.txt
@@ -14,10 +14,5 @@ endforeach()
 # the parent scope).
 set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
 
-add_executable(mvu
-  mvu_main.cpp
-)
-target_link_libraries(mvu
-  mlpack
-)
-install(TARGETS mvu RUNTIME DESTINATION bin)
+add_cli_executable(mvu)
+
diff --git a/src/mlpack/methods/naive_bayes/CMakeLists.txt b/src/mlpack/methods/naive_bayes/CMakeLists.txt
index 05f87fc..edeb9b4 100644
--- a/src/mlpack/methods/naive_bayes/CMakeLists.txt
+++ b/src/mlpack/methods/naive_bayes/CMakeLists.txt
@@ -14,10 +14,5 @@ endforeach()
 # the parent scope).
 set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
 
-add_executable(mlpack_nbc
-  nbc_main.cpp
-)
-target_link_libraries(mlpack_nbc
-  mlpack
-)
-install(TARGETS mlpack_nbc RUNTIME DESTINATION bin)
+add_cli_executable(nbc)
+
diff --git a/src/mlpack/methods/nca/CMakeLists.txt b/src/mlpack/methods/nca/CMakeLists.txt
index d49c63b..0854a93 100644
--- a/src/mlpack/methods/nca/CMakeLists.txt
+++ b/src/mlpack/methods/nca/CMakeLists.txt
@@ -16,10 +16,4 @@ endforeach()
 # the parent scope).
 set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
 
-add_executable(mlpack_nca
-  nca_main.cpp
-)
-target_link_libraries(mlpack_nca
-  mlpack
-)
-install(TARGETS mlpack_nca RUNTIME DESTINATION bin)
+add_cli_executable (nca)
diff --git a/src/mlpack/methods/neighbor_search/CMakeLists.txt b/src/mlpack/methods/neighbor_search/CMakeLists.txt
index fbf672f..dd26eeb 100644
--- a/src/mlpack/methods/neighbor_search/CMakeLists.txt
+++ b/src/mlpack/methods/neighbor_search/CMakeLists.txt
@@ -29,18 +29,6 @@ endforeach()
 # the parent scope).
 set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
 
-add_executable(mlpack_allknn
-  allknn_main.cpp
-)
-target_link_libraries(mlpack_allknn
-  mlpack
-)
-
-add_executable(mlpack_allkfn
-  allkfn_main.cpp
-)
-target_link_libraries(mlpack_allkfn
-  mlpack
-)
+add_cli_executable(allknn)
+add_cli_executable(allkfn)
 
-install(TARGETS mlpack_allknn mlpack_allkfn RUNTIME DESTINATION bin)
diff --git a/src/mlpack/methods/nmf/CMakeLists.txt b/src/mlpack/methods/nmf/CMakeLists.txt
index 71a33ed..8a29289 100644
--- a/src/mlpack/methods/nmf/CMakeLists.txt
+++ b/src/mlpack/methods/nmf/CMakeLists.txt
@@ -1,7 +1 @@
-add_executable(mlpack_nmf
-  nmf_main.cpp
-)
-target_link_libraries(mlpack_nmf
-  mlpack
-)
-install(TARGETS mlpack_nmf RUNTIME DESTINATION bin)
+add_cli_executable(nmf)
diff --git a/src/mlpack/methods/pca/CMakeLists.txt b/src/mlpack/methods/pca/CMakeLists.txt
index 258e022..a60462a 100644
--- a/src/mlpack/methods/pca/CMakeLists.txt
+++ b/src/mlpack/methods/pca/CMakeLists.txt
@@ -14,10 +14,5 @@ endforeach()
 # the parent scope).
 set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
 
-add_executable(mlpack_pca
-  pca_main.cpp
-)
-target_link_libraries(mlpack_pca
-  mlpack
-)
-install(TARGETS mlpack_pca RUNTIME DESTINATION bin)
+add_cli_executable(pca)
+
diff --git a/src/mlpack/methods/perceptron/CMakeLists.txt b/src/mlpack/methods/perceptron/CMakeLists.txt
index 3f91c84..75c002a 100644
--- a/src/mlpack/methods/perceptron/CMakeLists.txt
+++ b/src/mlpack/methods/perceptron/CMakeLists.txt
@@ -19,11 +19,4 @@ set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
 add_subdirectory(initialization_methods)
 add_subdirectory(learning_policies)
 
-add_executable(mlpack_perceptron
-  perceptron_main.cpp
-)
-target_link_libraries(mlpack_perceptron
-  mlpack
-)
-
-install(TARGETS mlpack_perceptron RUNTIME DESTINATION bin)
+add_cli_executable(perceptron)
diff --git a/src/mlpack/methods/radical/CMakeLists.txt b/src/mlpack/methods/radical/CMakeLists.txt
index 1729b3a..c1101c0 100644
--- a/src/mlpack/methods/radical/CMakeLists.txt
+++ b/src/mlpack/methods/radical/CMakeLists.txt
@@ -13,10 +13,5 @@ endforeach()
 # append sources (with directory name) to list of all mlpack sources (used at the parent scope)
 set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
 
-add_executable(mlpack_radical
-  radical_main.cpp
-)
-target_link_libraries(mlpack_radical
-  mlpack
-)
-install(TARGETS mlpack_radical RUNTIME DESTINATION bin)
+add_cli_executable(radical)
+
diff --git a/src/mlpack/methods/range_search/CMakeLists.txt b/src/mlpack/methods/range_search/CMakeLists.txt
index 54f9621..0195877 100644
--- a/src/mlpack/methods/range_search/CMakeLists.txt
+++ b/src/mlpack/methods/range_search/CMakeLists.txt
@@ -20,10 +20,5 @@ endforeach()
 # the parent scope).
 set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
 
-add_executable(mlpack_range_search
-  range_search_main.cpp
-)
-target_link_libraries(mlpack_range_search
-  mlpack
-)
-install(TARGETS mlpack_range_search RUNTIME DESTINATION bin)
+add_cli_executable(range_search)
+
diff --git a/src/mlpack/methods/rann/CMakeLists.txt b/src/mlpack/methods/rann/CMakeLists.txt
index 9cccfcc..2effb36 100644
--- a/src/mlpack/methods/rann/CMakeLists.txt
+++ b/src/mlpack/methods/rann/CMakeLists.txt
@@ -36,10 +36,4 @@ set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
 
 # The code to compute the rank-approximate neighbor
 # for the given query and reference sets
-add_executable(mlpack_allkrann
-  allkrann_main.cpp
-)
-target_link_libraries(mlpack_allkrann
-  mlpack
-)
-install(TARGETS mlpack_allkrann RUNTIME DESTINATION bin)
+add_cli_executable(allkrann)
diff --git a/src/mlpack/methods/softmax_regression/CMakeLists.txt b/src/mlpack/methods/softmax_regression/CMakeLists.txt
index 67ebb84..bf69266 100644
--- a/src/mlpack/methods/softmax_regression/CMakeLists.txt
+++ b/src/mlpack/methods/softmax_regression/CMakeLists.txt
@@ -16,10 +16,4 @@ endforeach()
 # the parent scope).
 set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
 
-add_executable(mlpack_softmax_regression
-  softmax_regression_main.cpp
-)
-target_link_libraries(mlpack_softmax_regression
-  mlpack
-)
-install(TARGETS mlpack_softmax_regression RUNTIME DESTINATION bin)
+add_cli_executable(softmax_regression)
diff --git a/src/mlpack/methods/sparse_coding/CMakeLists.txt b/src/mlpack/methods/sparse_coding/CMakeLists.txt
index 706e86b..db8227d 100644
--- a/src/mlpack/methods/sparse_coding/CMakeLists.txt
+++ b/src/mlpack/methods/sparse_coding/CMakeLists.txt
@@ -18,10 +18,5 @@ endforeach()
 # append sources (with directory name) to list of all mlpack sources (used at the parent scope)
 set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE)
 
-add_executable(mlpack_sparse_coding
-  sparse_coding_main.cpp
-)
-target_link_libraries(mlpack_sparse_coding
-  mlpack
-)
-install(TARGETS mlpack_sparse_coding RUNTIME DESTINATION bin)
+add_cli_executable(sparse_coding)
+




More information about the mlpack-git mailing list