Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 14 additions & 16 deletions cmake/thirdparty/SetupSmithThirdParty.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -561,27 +561,25 @@ if (NOT SMITH_THIRD_PARTY_LIBRARIES_FOUND)
message(STATUS "Smith Enable Gretl: ${SMITH_ENABLE_GRETL}")

if(SMITH_ENABLE_GRETL)
# Allow gretl as a non-submodule
if (DEFINED GRETL_SOURCE_DIR)
if(NOT EXISTS "${GRETL_SOURCE_DIR}/CMakeLists.txt")
message(FATAL_ERROR "Given GRETL_SOURCE_DIR does not contain CMakeLists.txt")
endif()
else()
if (NOT DEFINED GRETL_SOURCE_DIR)
set(GRETL_SOURCE_DIR "${PROJECT_SOURCE_DIR}/gretl" CACHE PATH "")
endif()

if (NOT EXISTS "${GRETL_SOURCE_DIR}/CMakeLists.txt")
message(FATAL_ERROR
"The gretl repo is not present. "
"Either run the following command in your git repository: \n"
" git submodule update --init --recursive\n"
"Or add -DGRETL_SOURCE_DIR=/path/to/gretl to your CMake command." )
endif()
# check if gretl exists in the GRETL_SOURCE_DIR, if not, try looking through the smith submodule
if (NOT EXISTS "${GRETL_SOURCE_DIR}/CMakeLists.txt")
set(GRETL_SOURCE_DIR "${PROJECT_SOURCE_DIR}/smith/gretl" CACHE PATH "" FORCE)
endif()

set(GRETL_FOUND TRUE)
message(STATUS "Gretl dir = ${GRETL_SOURCE_DIR}")
add_subdirectory("${GRETL_SOURCE_DIR}" ${CMAKE_BINARY_DIR}/gretl)
if (NOT EXISTS "${GRETL_SOURCE_DIR}/CMakeLists.txt")
message(FATAL_ERROR
"The gretl repo is not present. "
"Either run the following command in your git repository: \n"
" git submodule update --init --recursive\n"
"Or add -DGRETL_SOURCE_DIR=/path/to/gretl to your CMake command." )
endif()

add_subdirectory("${GRETL_SOURCE_DIR}" ${CMAKE_BINARY_DIR}/gretl)
set(GRETL_FOUND TRUE)
endif()


Expand Down