11# Include Dependencies
22add_subdirectory (fortran_csv_module)
33include (FetchContent)
4- FetchContent_Declare(
5- fplot
6- GIT_REPOSITORY "https://github.com/jchristopherson/fplot"
7- )
8- FetchContent_MakeAvailable(fplot)
9- set (fplot_LIBRARY fplot)
4+ find_package (ferror QUIET )
5+ find_package (fplot QUIET )
6+ if (NOT ferror_FOUND)
7+ FetchContent_Declare(
8+ ferror
9+ GIT_TAG "origin/master"
10+ GIT_REPOSITORY https://github.com/jchristopherson/ferror
11+ )
12+ FetchContent_MakeAvailable(ferror)
13+ set (ferror_LIBRARY ferror)
14+ else ()
15+ set (ferror_LIBRARY ferror::ferror)
16+ endif ()
17+ if (NOT fplot_FOUND)
18+ FetchContent_Declare(
19+ fplot
20+ GIT_TAG "origin/master"
21+ GIT_REPOSITORY https://github.com/jchristopherson/fplot
22+ )
23+ FetchContent_MakeAvailable(fplot)
24+ set (fplot_LIBRARY fplot)
25+ else ()
26+ set (fplot_LIBRARY fplot::fplot)
27+ endif ()
1028
1129# Full Factorial Example
1230add_executable (full_factorial_example full_factorial_example.f90)
@@ -32,47 +50,58 @@ configure_file(
3250)
3351add_executable (allan_example allan_example.f90)
3452target_link_libraries (allan_example fstats)
35- target_link_libraries (allan_example ${fplot_LIBRARY} )
53+ target_link_libraries (allan_example ${fplot_LIBRARY} ${ferror_LIBRARY} )
3654target_link_libraries (allan_example ${fortran-csv-module_LIBRARY})
3755target_include_directories (allan_example PUBLIC ${fortran-csv-module_INCLUDE_DIR})
3856
3957# Box-Muller Example
4058add_executable (box_muller_example box_muller_example.f90)
41- target_link_libraries (box_muller_example fstats ${fplot_LIBRARY} )
59+ target_link_libraries (box_muller_example fstats ${fplot_LIBRARY} ${ferror_LIBRARY} )
4260
4361# Rejection Sampling Example
4462add_executable (rejection_sample_example rejection_sample_example.f90)
45- target_link_libraries (rejection_sample_example fstats ${fplot_LIBRARY} )
63+ target_link_libraries (rejection_sample_example fstats ${fplot_LIBRARY} ${ferror_LIBRARY} )
4664
4765# LOWESS Example
4866add_executable (lowess_example lowess_example.f90)
49- target_link_libraries (lowess_example fstats ${fplot_LIBRARY} )
67+ target_link_libraries (lowess_example fstats ${fplot_LIBRARY} ${ferror_LIBRARY} )
5068
5169# Bootstrap Example
5270add_executable (bootstrap_example bootstrap_example.f90)
53- target_link_libraries (bootstrap_example fstats ${fplot_LIBRARY} )
71+ target_link_libraries (bootstrap_example fstats ${fplot_LIBRARY} ${ferror_LIBRARY} )
5472
5573# MCMC Regression Example
5674add_executable (mcmc_regression_example mcmc_regression_example.f90)
5775target_link_libraries (mcmc_regression_example fstats)
58- target_link_libraries (mcmc_regression_example ${fplot_LIBRARY} )
76+ target_link_libraries (mcmc_regression_example ${fplot_LIBRARY} ${ferror_LIBRARY} )
5977
6078# MCMC Regression Example 2
6179add_executable (mcmc_regression_example_2 mcmc_regression_example_2.f90)
6280target_link_libraries (mcmc_regression_example_2 fstats)
63- target_link_libraries (mcmc_regression_example_2 ${fplot_LIBRARY} )
81+ target_link_libraries (mcmc_regression_example_2 ${fplot_LIBRARY} ${ferror_LIBRARY} )
6482
6583# MCMC Regression Example 3
6684add_executable (mcmc_regression_example_3 mcmc_regression_example_3.f90)
6785target_link_libraries (mcmc_regression_example_3 fstats)
68- target_link_libraries (mcmc_regression_example_3 ${fplot_LIBRARY} )
86+ target_link_libraries (mcmc_regression_example_3 ${fplot_LIBRARY} ${ferror_LIBRARY} )
6987
7088# Distribution Example
7189add_executable (distribution_example distribution_example.f90)
7290target_link_libraries (distribution_example fstats)
73- target_link_libraries (distribution_example ${fplot_LIBRARY} )
91+ target_link_libraries (distribution_example ${fplot_LIBRARY} ${ferror_LIBRARY} )
7492
7593# Interpolation Example
7694add_executable (interpolation_example interpolation_example.f90)
7795target_link_libraries (interpolation_example fstats)
78- target_link_libraries (interpolation_example ${fplot_LIBRARY} )
96+ target_link_libraries (interpolation_example ${fplot_LIBRARY} ${ferror_LIBRARY} )
97+
98+ if (${BUILD_SHARED_LIBS} AND WIN32 )
99+ add_custom_command (
100+ TARGET full_factorial_example
101+ POST_BUILD
102+ COMMAND ${CMAKE_COMMAND} -E copy
103+ $<TARGET_RUNTIME_DLLS:full_factorial_example>
104+ $<TARGET_FILE_DIR:full_factorial_example>
105+ COMMAND_EXPAND_LISTS
106+ )
107+ endif ()
0 commit comments