katang
katang

Reputation: 2774

Why CMake doubles the path?

I am using UseLATEX, with commands

set(MainFile "Demo.tex")    
set(InputFiles ${MainFile} Main.tex OtherFiles.tex)

then later I use it like

  ADD_LATEX_DOCUMENT( ${MyFileName}  
    INPUTS     "${InputFiles}" )

and everything works fine. If I change to

file(GLOB_RECURSE InputFiles src/*.tex)

then I receive messages with a list of files I wanted to put into InputFiles, but preceeded with

"Could not find input file ${CMAKE_SOURCE_DIR}/${CMAKE_SOURCE_DIR}/OtherFiles.tex"

and of course that path does not exist. What is wrong?

Upvotes: 1

Views: 72

Answers (1)

Florian
Florian

Reputation: 42862

Turning my comment into answer

Haven't worked with ADD_LATEX_DOCUMENT(), but it seems it appends the current directory itself and would need relative paths.

Just change your file(GLOB ...) command to output relative paths:

file(GLOB_RECURSE InputFiles RELATIVE "${CMAKE_SOURCE_DIR}" src/*.tex)

Upvotes: 1

Related Questions