Skip to content

Commit

Permalink
Merge pull request #15 from gruenich/feature/improvements-from-dune-p…
Browse files Browse the repository at this point in the history
…roject

Upstream changes from Dune Project
  • Loading branch information
dokempf authored Dec 2, 2023
2 parents 7922306 + 98aa4b8 commit ddadf41
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# It is not actually needed for downstream use.
#

cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.10)
project(UseLatexMk)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR})
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ You just need to
* copy all the CMake modules (`*.cmake`) from this project into your project
* Include them with `include(UseLatexMk)`. This is best done from the top-level
directory of your project, to make the `clean_latex` target available on that level.
* Use CMake 3.5 or newer.
* Use CMake 3.10 or newer.

Now, you are ready to use it!

Expand Down
19 changes: 12 additions & 7 deletions UseLatexMk.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@
# system environment variable openout_any to "a" (as in "all"), to override the default "paranoid"
# setting.
#
# UseLatexMk.cmake allows to reenable the TeX security measure by setting LATEXMK_PARANOID to TRUE
# UseLatexMk.cmake allows to re-enable the TeX security measure by setting LATEXMK_PARANOID to TRUE
# through cmake -D, but it is not guaranteed to work correctly in that case.
#
# For further informations, visit https://github.com/dokempf/UseLatexMk
# For further information, visit https://github.com/dokempf/UseLatexMk
#
#
# Copyright (c) 2017, Dominic Kempf, Steffen Müthing
Expand Down Expand Up @@ -101,6 +101,12 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
include_guard(GLOBAL)

# ensure CMake version is recent enough
if(CMAKE_VERSION VERSION_LESS 3.10)
message(FATAL_ERROR "UseLatexMk.cmake requires CMake 3.10 or newer")
endif()

# Find LATEX and LatexMk
find_package(LATEX)
Expand All @@ -111,9 +117,9 @@ find_file(LATEXMKRC_TEMPLATE
latexmkrc.cmake
HINTS ${CMAKE_MODULE_PATH}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/cmake
${CMAKE_SOURCE_DIR}/cmake/modules
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/cmake
${PROJECT_SOURCE_DIR}/cmake/modules
NO_CMAKE_FIND_ROOT_PATH
)

Expand All @@ -131,7 +137,6 @@ function(add_latex_document)
set(OPTION REQUIRED EXCLUDE_FROM_ALL BUILD_ON_INSTALL)
set(SINGLE SOURCE TARGET INSTALL)
set(MULTI FATHER_TARGET RCFILE)
include(CMakeParseArguments)
cmake_parse_arguments(LMK "${OPTION}" "${SINGLE}" "${MULTI}" ${ARGN})

if(LMK_UNPARSED_ARGUMENTS)
Expand All @@ -145,7 +150,7 @@ function(add_latex_document)
if(NOT LMK_TARGET)
# Construct a nice target name from the source file
get_filename_component(LMK_TARGET ${LMK_SOURCE} ABSOLUTE)
file(RELATIVE_PATH LMK_TARGET ${CMAKE_SOURCE_DIR} ${LMK_TARGET})
file(RELATIVE_PATH LMK_TARGET ${PROJECT_SOURCE_DIR} ${LMK_TARGET})
string(REPLACE "/" "_" LMK_TARGET ${LMK_TARGET})
string(REPLACE "." "_" LMK_TARGET ${LMK_TARGET})
endif()
Expand Down

0 comments on commit ddadf41

Please sign in to comment.