Hello everyone,
I would need your guidance on the usage of a git submodule that generates an executable, which I want to call from the main cmake project.
So far, my project compiles properly, but the exe built from the submodule “is not recognized as an internal or external command”, when being called via a system call in the main source code. This is not a big surprise because my PATH variable does not have the /build/bin folder… What would you recommend? Note that the git submodule is not a static or dynamic library, but rather an executable.
My goal is to lock the version of the git submodule, so that the end users do not have to think about the dependency of the thrird-party tool. Also note that I plan on using cmake –install, i.e the path of both exe will be deployed somewhere else in a shared directory. So I want to make sure to have a robust solution.
Any help is appreciated,
thanks!
The structure is the following:
top-level CCMakeList.txt:
SET(SRC_GIT_SUBMODULE Source/SRC_GIT_SUBMODULE)
ADD_SUBDIRECTORY(${SRC_GIT_SUBMODULE})
ADD_EXECUTABLE(main main.f )
submodule CMakeList.txt:
# Include an optional PROJECT statement that only activates if this is being
# compiled standalone
IF (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
CMAKE_MINIMUM_REQUIRED(VERSION 3.15...3.31)
PROJECT(
testgitSubModule
VERSION ${VERSION_SD1}1.0.0
DESCRIPTION "test git submodule."
LANGUAGES Fortran)
ENDIF()
ADD_EXECUTABLE(test test.f)
Main fortran code calling the submodule:
call system("test.exe " // infile // outfile(1:dotpos-1))