Skip to content

Commit

Permalink
Some CMake fixes for when cprnc is included in a bigger project
Browse files Browse the repository at this point in the history
Need to check if genf90 is already defined; many users of cprnc will already
define this. Need to use CMAKE_CURRENT_SOURCE_DIR to ensure correct modules
are found.
  • Loading branch information
jgfouca committed Dec 13, 2023
1 parent 5e2ca5b commit 3cee6af
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ include (CheckFunctionExists)
include (ExternalProject)

#===== Local modules =====
list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

#==============================================================================
# DEFINE THE TARGET
Expand Down Expand Up @@ -37,8 +37,11 @@ endif()

#===== genf90 =====
if (DEFINED GENF90_PATH)
add_custom_target(genf90
DEPENDS ${GENF90_PATH}/genf90.pl)
# If GENF90_PATH is defined, the target may also already be defined
if (NOT TARGET genf90)
add_custom_target(genf90
DEPENDS ${GENF90_PATH}/genf90.pl)
endif()
else ()
ExternalProject_Add (genf90
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/genf90
Expand Down

0 comments on commit 3cee6af

Please sign in to comment.