File: remove-GreatCMakeCookOff-dependency.patch

package info (click to toggle)
purify 2.0.0-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 58,688 kB
  • sloc: cpp: 8,410; python: 375; makefile: 7
file content (561 lines) | stat: -rw-r--r-- 19,286 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
From: Ole Streicher <olebole@debian.org>
Date: Tue, 11 Oct 2016 08:39:17 +0200
Subject: remove GreatCMakeCookOff dependency

---
 CMakeLists.txt                                   |  20 +-
 cmake_files/GreatCMakeCookOff/AddCatchTest.cmake | 112 ++++++++++++
 cmake_files/GreatCMakeCookOff/FindCFitsIO.cmake  |  63 +++++++
 cmake_files/GreatCMakeCookOff/FindFFTW3.cmake    | 224 +++++++++++++++++++++++
 cmake_files/dependencies.cmake                   |  26 +--
 cmake_files/version.cmake                        |   5 +-
 cpp/purify/CMakeLists.txt                        |   3 +
 7 files changed, 417 insertions(+), 36 deletions(-)
 create mode 100644 cmake_files/GreatCMakeCookOff/AddCatchTest.cmake
 create mode 100644 cmake_files/GreatCMakeCookOff/FindCFitsIO.cmake
 create mode 100644 cmake_files/GreatCMakeCookOff/FindFFTW3.cmake

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4a8aeff..626a7e4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,14 +3,11 @@ project(Purify C CXX)
 
 # Location of extra cmake includes for the project
 list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_files)
-
-# Downloads and installs GreatCMakeCookOff
-# It contains a number of cmake recipes
-include(LookUp-GreatCMakeCookOff)
+list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_files/GreatCMakeCookOff)
 
 option(tests          "Enable testing"                                  on)
-option(examples       "Compile examples"                                on)
-option(data           "Download measurement set for testing"            on)
+option(examples       "Compile examples"                                off)
+option(data           "Download measurement set for testing"            off)
 option(openmp         "Enable OpenMP"                                   on)
 option(logging        "Enable logging"                                  on)
 
@@ -18,7 +15,9 @@ option(logging        "Enable logging"                                  on)
 include(version)
 
 # we are doing c++11
-include(AddCPP11Flags)
+set(CXX11_FLAGS "${CXX11_FLAGS} -std=gnu++11")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_FLAGS}")
+set(PROJECT_USES_CPP11 True CACHE INTERNAL "Uses c++11.")
 
 # sets up rpath so libraries can be found
 include(rpath)
@@ -28,13 +27,6 @@ include(logging)
 
 # include exernal dependencies
 include(dependencies)
-if(EXISTS "${EXTERNAL_ROOT}/lib/")
-    install(DIRECTORY "${EXTERNAL_ROOT}/lib/"
-        DESTINATION "${LIBRARY_INSTALL_PATH}"
-        PATTERN "pkgconfig" EXCLUDE
-        PATTERN "*.a" EXCLUDE
-    )
-endif()
 
 if(tests AND data)
     include(data_dependencies)
diff --git a/cmake_files/GreatCMakeCookOff/AddCatchTest.cmake b/cmake_files/GreatCMakeCookOff/AddCatchTest.cmake
new file mode 100644
index 0000000..177612b
--- /dev/null
+++ b/cmake_files/GreatCMakeCookOff/AddCatchTest.cmake
@@ -0,0 +1,112 @@
+# Function to create a common main
+function(common_catch_main)
+  if(TARGET common_catch_main_object)
+    return()
+  endif()
+  file(WRITE "${CMAKE_BINARY_DIR}/common_catch_main.cc"
+    "#define CATCH_CONFIG_MAIN\n"
+    "#include \"catch.hpp\"\n"
+  )
+  add_library(common_catch_main_object OBJECT "${CMAKE_BINARY_DIR}/common_catch_main.cc")
+  if(CATCH_INCLUDE_DIR)
+    target_include_directories(common_catch_main_object PRIVATE ${CATCH_INCLUDE_DIR})
+  endif()
+endfunction()
+
+# A function to create a test, once a an executable exists
+function(add_catch_test_with_seed testname testexec seed)
+  cmake_parse_arguments(catch "NOCATCHLABEL" "WORKING_DIRECTORY" "LABELS;ARGUMENTS" ${ARGN})
+
+  unset(EXTRA_ARGS)
+  if(catch_WORKING_DIRECTORY)
+    set(EXTRA_ARGS WORKING_DIRECTORY ${catch_WORKING_DIRECTORY})
+  endif()
+  set(arguments ${catch_ARGUMENTS})
+  if(NOT "${seed}" STREQUAL "")
+    list(APPEND arguments --rng-seed ${seed})
+  else()
+    list(APPEND arguments --rng-seed time)
+  endif()
+
+  if(CATCH_JUNIT)
+    add_test(NAME ${testname}
+      COMMAND ${testexec}
+          ${arguments}
+          -r junit
+          -o ${PROJECT_BINARY_DIR}/Testing/${testname}.xml
+    )
+  else()
+    add_test(NAME ${testname} COMMAND ${testexec} ${arguments} ${EXTRA_ARGS})
+  endif()
+
+  if(NOT catch_NOCATCHLABEL)
+    list(APPEND catch_LABELS catch)
+  endif()
+  set_tests_properties(${testname} PROPERTIES LABELS "${catch_LABELS}")
+endfunction()
+
+# Then adds a function to create a test
+function(add_catch_test testname)
+  cmake_parse_arguments(catch
+    "NOMAIN;NOTEST;NOCATCHLABEL"
+    "SEED;WORKING_DIRECTORY;COMMON_MAIN;PRECOMMAND"
+    "LIBRARIES;DEPENDS;INCLUDES;LABELS;ARGUMENTS"
+    ${ARGN}
+  )
+
+  # Source deduce from testname if possible
+  unset(source)
+  if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${testname}.cc")
+    set(source ${testname}.cc)
+  elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${testname}.cpp")
+    set(source ${testname}.cpp)
+  elseif("${catch_UNPARSED_ARGUMENTS}" STREQUAL "")
+    message(FATAL_ERROR "No source given or found for ${testname}")
+  endif()
+
+  # By default, uses a common main function for all, compiled once
+  # We create here
+  if(catch_NOMAIN)
+    add_executable(test_${testname} ${source} ${catch_UNPARSED_ARGUMENTS})
+  elseif(catch_COMMON_MAIN)
+    add_executable(test_${testname}
+      ${source} $<TARGET_OBJECTS:${catch_COMMON_MAIN}> ${catch_UNPARSED_ARGUMENTS})
+  else()
+    common_catch_main()
+    add_executable(test_${testname}
+      ${source} $<TARGET_OBJECTS:common_catch_main_object> ${catch_UNPARSED_ARGUMENTS})
+  endif()
+
+  if(catch_LIBRARIES)
+    target_link_libraries(test_${testname} ${catch_LIBRARIES})
+  endif()
+  if(CATCH_INCLUDE_DIR)
+    target_include_directories(test_${testname} PRIVATE ${CATCH_INCLUDE_DIR})
+  endif()
+  if(catch_INCLUDES)
+    target_include_directories(test_${testname} PRIVATE ${catch_INCLUDES})
+  endif()
+  if(catch_DEPENDS)
+    add_dependencies(test_${testname} ${catch_DEPENDS})
+  endif()
+  if(TARGET lookup_dependencies)
+    add_dependencies(test_${testname} lookup_dependencies)
+  endif()
+
+  if(catch_NOCATCHLABEL)
+    set(catch_NOCATCHLABEL "NOCATCHLABEL")
+  else()
+    unset(catch_NOCATCHLABEL)
+  endif()
+  set(test_command test_${testname})
+  if(catch_PRECOMMAND)
+    set(test_command "${catch_PRECOMMAND} ${test_command}")
+  endif()
+  if(NOT catch_NOTEST)
+    add_catch_test_with_seed(
+      test_${testname} "test_${testname}" "${catch_SEED}" ${catch_UNPARSED_ARGUMENTS}
+      ${catch_NOCATCHLABEL} WORKING_DIRECTORY ${catch_WORKING_DIRECTORY}
+      LABELS ${catch_LABELS} ARGUMENTS ${catch_ARGUMENTS}
+    )
+  endif()
+endfunction()
diff --git a/cmake_files/GreatCMakeCookOff/FindCFitsIO.cmake b/cmake_files/GreatCMakeCookOff/FindCFitsIO.cmake
new file mode 100644
index 0000000..65e9088
--- /dev/null
+++ b/cmake_files/GreatCMakeCookOff/FindCFitsIO.cmake
@@ -0,0 +1,63 @@
+# Defines the following variables
+#
+# - CFitsIO_FOUND if the library is found
+# - CFitsIO_LIBRARY is the path to the library
+# - CFitsIO_INCLUDE_DIR is the path to the include directory
+# - CFitsIO_VERSION_STRING is the version of the library
+if(CFitsIO_FOUND)
+  return()
+endif()
+
+find_library(CFitsIO_LIBRARY cfitsio DOC "Path to the cfitsio library")
+if(NOT "$ENV{CASAPATH}" STREQUAL "")
+    string(FIND "$ENV{CASAPATH}" " " endpath)
+    string(SUBSTRING "$ENV{CASAPATH}" 0 ${endpath} casapath)
+
+    find_library(
+      CFitsIO_LIBRARY cfitsio
+      NAMES libcfitsio${CMAKE_SHARED_LIBRARY_SUFFIX}.1 libcfitsio${CMAKE_SHARED_LIBRARY_SUFFIX}.0
+      PATHS "${casapath}" "${casapath}/Frameworks"
+      DOC "Path to the cfitsio library"
+    )
+endif()
+find_path(
+  CFitsIO_INCLUDE_DIR fitsio.h
+  PATH_SUFFIXES include include/cfitsio Frameworks/Headers/cfitsio
+  DOC "Path to the cfitsio include directory"
+  PATHS "${casapath}"
+)
+
+if(CFitsIO_INCLUDE_DIR)
+  file(
+    STRINGS ${CFitsIO_INCLUDE_DIR}/fitsio.h
+    CFitsIO_VERSION_STRING
+    REGEX "#define[ ]+CFITSIO_VERSION[ ]+([0-9]*\\.[0-9]*)"
+  )
+  string(
+    REGEX REPLACE
+    ".*#define[ ]+CFITSIO_VERSION[ ]+([0-9]*\\.[0-9]*).*"
+    "\\1"
+    CFitsIO_VERSION_STRING
+    "${CFitsIO_VERSION_STRING}"
+  )
+endif()
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(
+  CFitsIO
+  REQUIRED_VARS CFitsIO_LIBRARY CFitsIO_INCLUDE_DIR
+  VERSION_VAR CFitsIO_VERSION_STRING
+)
+if(CFITSIO_FOUND AND NOT CFitsIO_FOUND)
+    set(CFitsIO_FOUND ${CFITSIO_FOUND})
+endif()
+if(CFitsIO_FOUND)
+  if(CFitsIO_LIBRARY MATCHES "\\.a$")
+    add_library(cfitsio STATIC IMPORTED GLOBAL)
+  else()
+    add_library(cfitsio SHARED IMPORTED GLOBAL)
+  endif()
+  set_target_properties(cfitsio PROPERTIES
+    IMPORTED_LOCATION "${CFitsIO_LIBRARY}"
+    INTERFACE_INCLUDE_DIRECTORIES "${CFitsIO_INCLUDE_DIR}")
+endif()
diff --git a/cmake_files/GreatCMakeCookOff/FindFFTW3.cmake b/cmake_files/GreatCMakeCookOff/FindFFTW3.cmake
new file mode 100644
index 0000000..617f890
--- /dev/null
+++ b/cmake_files/GreatCMakeCookOff/FindFFTW3.cmake
@@ -0,0 +1,224 @@
+# - Try to find FFTW
+# Once done this will define
+#  FFTW3_FOUND - System has FFTW3
+#  FFTW3_INCLUDE_DIRS - The FFTW3 include directories
+#  FFTW3_LIBRARIES - The libraries needed to use FFTW3
+#  FFTW3_DEFINITIONS - Compiler switches required for using FFTW3
+#  FFTW3_$KIND_$PARALLEL_FOUND- Set if FFTW3 exists in KIND precision format for PARALLEL mode.
+#                             where KIND can be: SINGLE, DOUBLE, LONGDOUBLE
+#                             and PARALLEL: SERIAL, OPENMP, MPI, THREADS.
+#  FFTW3_$KIND_$PARALLEL_LIBRARY - The libraries needed to use.
+#  FFTW3_INCLUDE_DIR_PARALLEL - The FFTW3 include directories for parallels mode.
+
+cmake_policy(SET CMP0054 NEW)
+
+if(FFTW3_FOUND)
+  return()
+endif()
+
+if(FFTW3_INCLUDE_DIR AND FFTW3_LIBRARIES)
+  set(FFTW3_FOUND TRUE)
+  foreach(component ${FFTW3_FIND_COMPONENTS})
+    if("${FFTW3_${component}_LIBRARY}" STREQUAL "")
+        set(FFTW3_${component}_LIBRARY "${FFTW3_LIBRARIES}")
+    endif()
+  endforeach()
+  return()
+endif()
+
+macro(find_specific_libraries KIND PARALLEL)
+  list(APPEND FFTW3_FIND_COMPONENTS ${KIND}_${PARALLEL})
+  if(NOT (${PARALLEL} STREQUAL "SERIAL") AND NOT ${PARALLEL}_FOUND)
+    message(FATAL_ERROR "Please, find ${PARALLEL} libraries before FFTW")
+  endif()
+
+  find_library(FFTW3_${KIND}_${PARALLEL}_LIBRARY NAMES
+    fftw3${SUFFIX_${KIND}}${SUFFIX_${PARALLEL}}${SUFFIX_FINAL} HINTS ${HINT_DIRS})
+  if(FFTW3_${KIND}_${PARALLEL}_LIBRARY MATCHES fftw3)
+    list(APPEND FFTW3_LIBRARIES ${FFTW3_${KIND}_${PARALLEL}_LIBRARY})
+    set(FFTW3_${KIND}_${PARALLEL}_FOUND TRUE)
+
+    STRING(TOLOWER "${KIND}" kind)
+    STRING(TOLOWER "${PARALLEL}" parallel)
+    if(FFTW3_${kind}_${parallel}_LIBRARY MATCHES "\\.a$")
+      add_library(fftw3::${kind}::${parallel} STATIC IMPORTED GLOBAL)
+    else()
+      add_library(fftw3::${kind}::${parallel} SHARED IMPORTED GLOBAL)
+    endif()
+
+    # MPI Has a different included library than the others
+    # FFTW3_INCLUDE_DIR_PARALLEL will change depending of which on is used.
+    set(FFTW3_INCLUDE_DIR_PARALLEL ${FFTW3_INCLUDE_DIR} )
+    if(PARALLEL STREQUAL "MPI")
+      set(FFTW3_INCLUDE_DIR_PARALLEL ${FFTW3_${PARALLEL}_INCLUDE_DIR})
+    endif()
+
+    set_target_properties(fftw3::${kind}::${parallel} PROPERTIES
+      IMPORTED_LOCATION "${FFTW3_${KIND}_${PARALLEL}_LIBRARY}"
+      INTERFACE_INCLUDE_DIRECTORIES "${FFTW3_INCLUDE_DIR_PARALLEL}")
+
+    # adding target properties to the different cases
+    ##   MPI
+    if(PARALLEL STREQUAL "MPI")
+      if(MPI_C_LIBRARIES)
+        set_target_properties(fftw3::${kind}::mpi PROPERTIES
+          IMPORTED_LOCATION "${FFTW3_${KIND}_${PARALLEL}_LIBRARY}"
+          INTERFACE_INCLUDE_DIRECTORIES "${FFTW3_INCLUDE_DIR_PARALLEL}"
+          IMPORTED_LINK_INTERFACE_LIBRARIES ${MPI_C_LIBRARIES})
+      endif()
+    endif()
+    ##   OpenMP
+    if(PARALLEL STREQUAL "OPENMP")
+      if(OPENMP_C_FLAGS)
+        set_target_properties(fftw3::${kind}::${parallel} PROPERTIES
+           IMPORTED_LOCATION "${FFTW3_${KIND}_${PARALLEL}_LIBRARY}"
+           INTERFACE_INCLUDE_DIRECTORIES "${FFTW3_INCLUDE_DIR_PARALLEL}"
+           INTERFACE_COMPILE_OPTIONS "${OPENMP_C_FLAGS}")
+        endif()
+    endif()
+    ##  THREADS
+    if(PARALLEL STREQUAL "THREADS")
+      if(CMAKE_THREAD_LIBS_INIT) # TODO: this is not running
+        set_target_properties(fftw3::${kind}::${parallel} PROPERTIES
+          IMPORTED_LOCATION "${FFTW3_${KIND}_${PARALLEL}_LIBRARY}"
+          INTERFACE_INCLUDE_DIRECTORIES "${FFTW3_INCLUDE_DIR_PARALLEL}"
+          INTERFACE_COMPILE_OPTIONS "${CMAKE_THREAD_LIBS_INIT}")
+      endif()
+    endif()
+  endif()
+endmacro()
+
+
+
+
+if(NOT FFTW3_FIND_COMPONENTS)
+  set(FFTW3_FIND_COMPONENTS SINGLE DOUBLE LONGDOUBLE SERIAL)
+endif()
+
+string(TOUPPER "${FFTW3_FIND_COMPONENTS}" FFTW3_FIND_COMPONENTS)
+
+list(FIND FFTW3_FIND_COMPONENTS SINGLE LOOK_FOR_SINGLE)
+list(FIND FFTW3_FIND_COMPONENTS DOUBLE LOOK_FOR_DOUBLE)
+list(FIND FFTW3_FIND_COMPONENTS LONGDOUBLE LOOK_FOR_LONGDOUBLE)
+list(FIND FFTW3_FIND_COMPONENTS THREADS LOOK_FOR_THREADS)
+list(FIND FFTW3_FIND_COMPONENTS OPENMP LOOK_FOR_OPENMP)
+list(FIND FFTW3_FIND_COMPONENTS MPI LOOK_FOR_MPI)
+list(FIND FFTW3_FIND_COMPONENTS SERIAL LOOK_FOR_SERIAL)
+
+# FIXME - This may fail in computers wihtout serial
+# Default serial to obtain version number
+set(LOOK_FOR_SERIAL 1)
+
+# set serial as default if none parallel component has been set
+if((LOOK_FOR_THREADS LESS 0) AND (LOOK_FOR_MPI LESS 0) AND
+    (LOOK_FOR_OPENMP LESS 0))
+  set(LOOK_FOR_SERIAL 1)
+endif()
+
+if(MPI_C_FOUND)
+  set(MPI_FOUND ${MPI_C_FOUND})
+endif()
+unset(FFTW3_FIND_COMPONENTS)
+
+
+
+
+if(WIN32)
+  set(HINT_DIRS ${FFTW3_DIRECTORY} $ENV{FFTW3_DIRECTORY})
+else()
+  find_package(PkgConfig)
+  if(PKG_CONFIG_FOUND)
+    pkg_check_modules(PC_FFTW QUIET fftw3)
+    set(FFTW3_DEFINITIONS ${PC_FFTW3_CFLAGS_OTHER})
+  endif()
+  set(HINT_DIRS ${PC_FFTW3_INCLUDEDIR} ${PC_FFTW3_INCLUDE_DIRS}
+    ${FFTW3_INCLUDE_DIR} $ENV{FFTW3_INCLUDE_DIR} )
+endif()
+
+find_path(FFTW3_INCLUDE_DIR NAMES fftw3.h HINTS ${HINT_DIRS})
+if (LOOK_FOR_MPI)  # Probably is going to be the same as fftw3.h
+  find_path(FFTW3_MPI_INCLUDE_DIR NAMES fftw3-mpi.h HINTS ${HINT_DIRS})
+endif()
+
+function(find_version OUTVAR LIBRARY SUFFIX)
+    file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/fftw${SUFFIX}/main.c
+      # TODO: do we need to add include for mpi headers?
+      "#include <fftw3.h>
+       #include <stdio.h>
+       int main(int nargs, char const *argv[]) {
+           printf(\"%s\", fftw${SUFFIX}_version);
+           return 0;
+       }"
+  )
+if(NOT CMAKE_CROSSCOMPILING)
+    try_run(RUN_RESULT COMPILE_RESULT
+        "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/fftw${SUFFIX}/"
+        "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/fftw${SUFFIX}/main.c"
+        CMAKE_FLAGS
+          -DLINK_LIBRARIES=${LIBRARY}
+          -DINCLUDE_DIRECTORIES=${FFTW3_INCLUDE_DIR}
+        RUN_OUTPUT_VARIABLE OUTPUT
+        COMPILE_OUTPUT_VARIABLE COUTPUT
+    )
+  endif()
+  if(RUN_RESULT EQUAL 0)
+    string(REGEX REPLACE
+        ".*([0-9]+\\.[0-9]+\\.[0-9]+).*"
+        "\\1" VERSION_STRING "${OUTPUT}"
+    )
+    set(${OUTVAR} ${VERSION_STRING} PARENT_SCOPE)
+  endif()
+endfunction()
+
+set(SUFFIX_DOUBLE "")
+set(SUFFIX_SINGLE "f")
+set(SUFFIX_LONGDOUBLE "l")
+set(SUFFIX_SERIAL "")
+set(SUFFIX_OPENMP "_omp")
+set(SUFFIX_MPI "_mpi")
+set(SUFFIX_THREADS "_threads")
+set(SUFFIX_FINAL "")
+
+if(WIN32)
+  set(SUFFIX_FINAL "-3")
+else()
+  set(HINT_DIRS ${PC_FFTW3_LIBDIR} ${PC_FFTW3_LIBRARY_DIRS}
+    $ENV{FFTW3_LIBRARY_DIR} ${FFTW3_LIBRARY_DIR} )
+endif(WIN32)
+
+unset(FFTW3_LIBRARIES)
+set(FFTW3_INCLUDE_DIRS ${FFTW3_INCLUDE_DIR} ) # TODO what's for?
+set(FFTW3_FLAGS_C "")
+foreach(KIND SINGLE DOUBLE LONGDOUBLE)
+  if(LOOK_FOR_${KIND} LESS 0)
+    continue()
+  endif()
+  foreach(PARALLEL SERIAL MPI OPENMP THREADS)
+    if(LOOK_FOR_${PARALLEL} LESS 0)
+      continue()
+    endif()
+    find_specific_libraries(${KIND} ${PARALLEL})
+  endforeach()
+endforeach()
+
+if(FFTW3_INCLUDE_DIR)
+  list(GET FFTW3_FIND_COMPONENTS 0 smallerrun)
+  string(REPLACE "_" ";" RUNLIST ${smallerrun})
+  list(GET RUNLIST 0 KIND)
+  list(GET RUNLIST 1 PARALLEL)
+  unset(smallerrun)
+  unset(RUNLIST)
+  # suffix is quoted so it pass empty in the case of double as it's empty
+  find_version(FFTW3_VERSION_STRING ${FFTW3_${KIND}_${PARALLEL}_LIBRARY}
+    "${SUFFIX_${KIND}}")
+endif()
+
+# FIXME: fails if use REQUIRED.
+include(FindPackageHandleStandardArgs)
+# handle the QUIETLY and REQUIRED arguments and set FFTW3_FOUND to TRUE
+# if all listed variables are TRUE
+find_package_handle_standard_args(FFTW3
+    REQUIRED_VARS FFTW3_LIBRARIES FFTW3_INCLUDE_DIR
+    VERSION_VAR FFTW3_VERSION_STRING
+    HANDLE_COMPONENTS
+)
diff --git a/cmake_files/dependencies.cmake b/cmake_files/dependencies.cmake
index 8f5fa0b..1a0984d 100644
--- a/cmake_files/dependencies.cmake
+++ b/cmake_files/dependencies.cmake
@@ -1,8 +1,3 @@
-# Scripts to run purify from build directory. Good for testing/debuggin.
-include(EnvironmentScript)
-# Look up packages: if not found, installs them
-include(PackageLookup)
-
 # Look for external software
 if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
   find_package(Threads)
@@ -36,15 +31,16 @@ find_package(TIFF REQUIRED)
 
 
 if(data AND tests)
-  lookup_package(Boost REQUIRED COMPONENTS filesystem)
+  find_package(Boost REQUIRED COMPONENTS filesystem)
 else()
-  lookup_package(Boost REQUIRED)
+  find_package(Boost REQUIRED)
 endif()
 
-lookup_package(Eigen3 REQUIRED DOWNLOAD_BY_DEFAULT ARGUMENTS HG_REPOSITORY "https://bitbucket.org/LukePratley/eigen" HG_TAG "3.2")
+find_package(Eigen3 REQUIRED)
 
 if(logging)
-  lookup_package(spdlog REQUIRED)
+  find_package(spdlog REQUIRED)
+  add_definitions("-DSPDLOG_FMT_EXTERNAL")
 endif()
 
 # Look up packages: if not found, installs them
@@ -66,15 +62,9 @@ endif()
 if(NOT Sopt_FOUND)
   message(STATUS "If downloading Sopt locally, then it will be branch ${sopt_tag}")
 endif()
-lookup_package(
-    Sopt REQUIRED ARGUMENTS
-    GIT_REPOSITORY https://www.github.com/basp-group/sopt.git
-    GIT_TAG ${sopt_tag})
+find_package(Sopt REQUIRED)
 
-lookup_package(CFitsIO REQUIRED ARGUMENTS CHECKCASA)
-lookup_package(CCFits REQUIRED)
+find_package(CFitsIO REQUIRED ARGUMENTS CHECKCASA)
+find_package(CCFits REQUIRED)
 
 find_package(CasaCore OPTIONAL_COMPONENTS ms)
-
-# Add script to execute to make sure libraries in the build tree can be found
-add_to_ld_path("${EXTERNAL_ROOT}/lib")
diff --git a/cmake_files/version.cmake b/cmake_files/version.cmake
index 54da09f..7176e7f 100644
--- a/cmake_files/version.cmake
+++ b/cmake_files/version.cmake
@@ -1,7 +1,4 @@
-include(VersionAndGitRef)
-set_version(2.0.0)
-get_gitref()
-
+set(Purify_VERSION 2.0.0)
 set(version ${Purify_VERSION})
 string(REGEX REPLACE "\\." ";" version "${Purify_VERSION}")
 list(GET version 0 Purify_VERSION_MAJOR)
diff --git a/cpp/purify/CMakeLists.txt b/cpp/purify/CMakeLists.txt
index edceff2..bbf2119 100644
--- a/cpp/purify/CMakeLists.txt
+++ b/cpp/purify/CMakeLists.txt
@@ -53,6 +53,9 @@ endif()
 if(TARGET openmp::openmp)
   target_link_libraries(libpurify openmp::openmp)
 endif()
+if(logging)
+  target_link_libraries(libpurify "-lspdlog -lfmt")
+endif()
 
 add_dependencies(libpurify lookup_dependencies)