Skip to content

Commit

Permalink
cmake: call fypp with the CMake-found Python interpreter
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-zero committed Oct 20, 2020
1 parent 97086fa commit a37026c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ find_package(LAPACK REQUIRED) # needed for some of the integrated test routines,
# also calls find_package(BLAS)

# =================================== Python this module looks preferably for
# version 3 of Python. If not found, version 2 is searched In CMake 3.15, if a
# version 3 of Python. If not found, version 2 is searched. In CMake 3.15, if a
# python virtual environment is activated, it will search the virtual
# environment for a python interpreter before searching elsewhere in the system.
# In CMake <3.15, the system is searched before the virtual environment.
Expand Down
6 changes: 1 addition & 5 deletions cmake/CheckCompilerSupport.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
include(CheckFortranSourceCompiles)

set(CHECK_PROGRAMS f2008-norm2.f90 f2008-block_construct.f90
f2008-contiguous.f90)

if (CMAKE_Fortran_COMPILER_ID STREQUAL "PGI")
set(CHECK_PROGRAMS ${CHECK_PROGRAMS} f95-reshape-order-allocatable.f90)
endif ()
f2008-contiguous.f90 f95-reshape-order-allocatable.f90)

foreach (prog ${CHECK_PROGRAMS})
get_filename_component(prog_ext ${prog} EXT) # get the src extension to pass
Expand Down
5 changes: 3 additions & 2 deletions cmake/fypp-sources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ function (ADD_FYPP_SOURCES OUTVAR)
# now add the custom command to generate the output file
add_custom_command(
OUTPUT "${of}"
COMMAND ${FYPP_EXECUTABLE} ARGS ${fypp_flags} "${f}" "${of}"
COMMAND ${Python_EXECUTABLE} ${FYPP_EXECUTABLE} ARGS ${fypp_flags}
"${f}" "${of}"
MAIN_DEPENDENCY "${f}"
VERBATIM)
elseif ("${f}" MATCHES ".h$")
Expand All @@ -65,7 +66,7 @@ function (ADD_FYPP_SOURCES OUTVAR)
# now add the custom command to generate the output file
add_custom_command(
OUTPUT "${of}"
COMMAND ${FYPP_EXECUTABLE} ARGS "-F" "${f}" "${of}"
COMMAND ${Python_EXECUTABLE} ${FYPP_EXECUTABLE} ARGS "-F" "${f}" "${of}"
DEPENDS "${f}")
else ()
configure_file("${f}" "${of}" COPYONLY)
Expand Down

0 comments on commit a37026c

Please sign in to comment.