From 9cd5bec89ca0d24e878944eddff1ee26313d84d4 Mon Sep 17 00:00:00 2001 From: xantares Date: Fri, 15 Apr 2016 09:33:00 +0000 Subject: [PATCH] Add an option to disable CLI executables the cmake option BUILD_CLI_EXECUTABLES is added --- CMakeLists.txt | 1 + src/mlpack/methods/CMakeLists.txt | 13 +++++++ src/mlpack/methods/adaboost/CMakeLists.txt | 8 +--- src/mlpack/methods/cf/CMakeLists.txt | 8 +--- .../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 ++----------------- .../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 +---- .../local_coordinate_coding/CMakeLists.txt | 9 +---- ...n.cpp => local_coordinate_coding_main.cpp} | 0 .../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 +--- .../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 +---- .../methods/range_search/CMakeLists.txt | 9 +---- src/mlpack/methods/rann/CMakeLists.txt | 8 +--- .../methods/softmax_regression/CMakeLists.txt | 8 +--- .../methods/sparse_coding/CMakeLists.txt | 9 +---- 32 files changed, 64 insertions(+), 259 deletions(-) rename src/mlpack/methods/local_coordinate_coding/{lcc_main.cpp => local_coordinate_coding_main.cpp} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 64ff308daa..6425ae2b10 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 be5dc80764..7e2fa33ac6 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 1a734dda93..af2c59a9bb 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 5b3c777cf6..30f5a4fb98 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 c485f704dd..c0cb4bb42a 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 b356db7344..73b0474eeb 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 90817b9936..dfcc332253 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 e1524bb593..9f7c8f5673 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 5587f99200..e443cc25ab 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 6d1dbd0d7b..245a2e5d39 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_cli_executable(hmm_train) +add_cli_executable(hmm_loglik) +add_cli_executable(hmm_viterbi) +add_cli_executable(hmm_generate) -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 -) - -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 1420dbfc05..b43e1938ea 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 55f1cadc9e..837aec78f6 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 168373c576..2c3eafc666 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 00c72e268e..938be8cfef 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 c4058d2dff..70270ae2af 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 ca3495e490..67db549551 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 5b384dc3d8..50906c2540 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 4324100e3e..3540e04c7b 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 da74e0edf8..7e32c34f86 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 a208a14142..187b48e2b6 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 05f87fc726..edeb9b49e9 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 d49c63bcfb..0854a93756 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 fbf672fe5f..dd26eeba80 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_cli_executable(allknn) +add_cli_executable(allkfn) -add_executable(mlpack_allkfn - allkfn_main.cpp -) -target_link_libraries(mlpack_allkfn - mlpack -) - -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 71a33ed4c4..8a29289607 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 258e022a3f..a60462a6d1 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 3f91c84939..75c002a3c9 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 1729b3a9f5..c1101c0ded 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 54f96213f0..0195877ad6 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 9cccfcc13e..2effb36411 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 67ebb845b2..bf69266fc9 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 706e86bbb4..db8227d6e7 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) +