Skip to content

Commit

Permalink
Fix build with MSYS
Browse files Browse the repository at this point in the history
  • Loading branch information
robertodr committed Aug 7, 2018
1 parent 6a33cea commit 175d142
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions chapter-08/recipe-03/c-example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ set(CMAKE_C_STANDARD 99)
set(CMAKE_C_EXTENSIONS OFF)
set(CMAKE_C_STANDARD_REQUIRED ON)

set_property(DIRECTORY PROPERTY EP_BASE ${CMAKE_BINARY_DIR}/subprojects)

option(FFTW3_FORCE_SUPERBUILD "Always build FFTW3 on our own" OFF)

add_subdirectory(external/upstream)

include(ExternalProject)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
find_package(FFTW3 CONFIG QUIET)
if(FFTW3_FOUND)
if(FFTW3_FOUND AND (NOT FFTW3_FORCE_SUPERBUILD))
get_property(_loc TARGET FFTW3::fftw3 PROPERTY LOCATION)
message(STATUS "Found FFTW3: ${_loc} (found version ${FFTW3_VERSION})")
add_library(fftw3_external INTERFACE) # dummy
else()
message(STATUS "Suitable FFTW3 could not be located. Downloading and building!")
if(FFTW3_FORCE_SUPERBUILD)
message(STATUS "Forcing superbuild of FFTW3.")
else()
message(STATUS "Suitable FFTW3 could not be located. Downloading and building!")
endif()
include(ExternalProject)
ExternalProject_Add(fftw3_external
URL
Expand All @@ -17,6 +21,8 @@ else()
""
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_PREFIX}
CMAKE_CACHE_ARGS
-DCMAKE_C_FLAGS:STRING=-DWITH_OUR_MALLOC
)
include(GNUInstallDirs)
set(FFTW3_DIR ${DEPS_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/cmake/fftw3
Expand Down

0 comments on commit 175d142

Please sign in to comment.