hi!
I am a technical writer and I have a book that works approximately as follows:
set(Installation_Name
Installation/Chapter1.md
Installation/Chapter2.md
)
add_custom_command(OUTPUT Installation_Output
COMMAND cat ${Installation_Name} > Book.md
COMMAND ${Pandoc_Command_Version} Book.md -o Book.pdf
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/MD/"
VERBATIM
)
add_custom_target(MyDocs ALL DEPENDS Installation_Output)
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/src/MD/Book.pdf
I want to make a construction that allows me to do something like that:
set(Installation_Name
Installation/Chapter1.md
Installation/Chapter2.md
)
if(${WORKING_DIRECTORY} STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/src/MD/")
set(Installation_Name
Installation/Chaper3.md
)
elseif(${WORKING_DIRECTORY} STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/src/MD_special/")
set(Installation_Name
Special_Installation/Chaper4.md
)
endif()
)
set(Installation_Name
Installation/Chapter5.md
Installation/Chapter6.md
)
...
that is, I need the cmake file to start fulfilling the conditions: if the directory is “src/MD/”, then use the “Installation/Chaper3.md” chapter, and if the directory is different, then use another chapter
I tried to use the above code (I wrote it approximately), but I’m not very familiar with the cmake syntax yet and obviously made a mistake somewhere
Please tell me how can I execute this scenario and what am I doing wrong?