Skip to content

Commit

Permalink
Fixes #483. Move to use CACHE INTERNAL
Browse files Browse the repository at this point in the history
  • Loading branch information
mathomp4 committed Mar 6, 2025
1 parent 691221a commit cf37fb6
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 15 deletions.
22 changes: 11 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -220,25 +220,25 @@ export(EXPORT PFUNIT
# Set some variables needed by add_pfunit_test in the parent scope so
# that the build directory can be used directly
if (NOT MAIN_PROJECT)
set(PFUNIT_MPI_FOUND "${MPI_Fortran_FOUND}" PARENT_SCOPE)
set(PFUNIT_MPI_USE_MPIEXEC "${MPI_USE_MPIEXEC}" PARENT_SCOPE)
set(PFUNIT_PARSER "${Python_EXECUTABLE}" "${PROJECT_SOURCE_DIR}/bin/funitproc" PARENT_SCOPE)
set(PFUNIT_DRIVER "${PROJECT_SOURCE_DIR}/include/driver.F90" PARENT_SCOPE)
set(PFUNIT_TESTUTILS "${PROJECT_SOURCE_DIR}/include/TestUtil.F90" PARENT_SCOPE)
set(PFUNIT_MPI_FOUND "${MPI_Fortran_FOUND}" CACHE INTERNAL "")
set(PFUNIT_MPI_USE_MPIEXEC "${MPI_USE_MPIEXEC}" CACHE INTERNAL "")
set(PFUNIT_PARSER "${Python_EXECUTABLE}" "${PROJECT_SOURCE_DIR}/bin/funitproc" CACHE INTERNAL "")
set(PFUNIT_DRIVER "${PROJECT_SOURCE_DIR}/include/driver.F90" CACHE INTERNAL "")
set(PFUNIT_TESTUTILS "${PROJECT_SOURCE_DIR}/include/TestUtil.F90" CACHE INTERNAL "")

if (BUILD_SHARED_LIBS)
set (PFUNIT_SERIAL_LIBRARIES PFUNIT::funit_shared PARENT_SCOPE)
set (PFUNIT_SERIAL_LIBRARIES PFUNIT::funit_shared CACHE INTERNAL "")
if (MPI_Fortran_FOUND)
set(PFUNIT_LIBRARIES PFUNIT::pfunit_shared PARENT_SCOPE)
set(PFUNIT_LIBRARIES PFUNIT::pfunit_shared CACHE INTERNAL "")
else()
set(PFUNIT_LIBRARIES PFUNIT::funit_shared PARENT_SCOPE)
set(PFUNIT_LIBRARIES PFUNIT::funit_shared CACHE INTERNAL "")
endif()
else()
set (PFUNIT_SERIAL_LIBRARIES PFUNIT::funit PARENT_SCOPE)
set (PFUNIT_SERIAL_LIBRARIES PFUNIT::funit CACHE INTERNAL "")
if (MPI_Fortran_FOUND)
set(PFUNIT_LIBRARIES PFUNIT::pfunit PARENT_SCOPE)
set(PFUNIT_LIBRARIES PFUNIT::pfunit CACHE INTERNAL "")
else()
set(PFUNIT_LIBRARIES PFUNIT::funit PARENT_SCOPE)
set(PFUNIT_LIBRARIES PFUNIT::funit CACHE INTERNAL "")
endif()
endif()

Expand Down
7 changes: 7 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- Change CMake from using `PARENT_SCOPE` to `CACHE INTERNAL` as it seems in some setups using
pFUnit via `FetchContent` the former does not work as expected.
- Update some `cmake_minimum_required` to 3.12 to avoid some warnings
- Update some `COMMENT` lines in functions with double-quotes to avoid warnings

## [4.11.1] - 2025-02-04

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion src/funit/asserts/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function (expand in out)
COMMAND ${Python_EXECUTABLE} ${PFUNIT_SOURCE_DIR}/tools/overload_template.py --rank=${rank} -i ${in} -o ${out} ${python_defs}
DEPENDS ${in} ${PFUNIT_SOURCE_DIR}/tools/overload_template.py
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT Generating ${out}
COMMENT "Generating ${out}"
)
endfunction()

Expand Down
2 changes: 1 addition & 1 deletion src/funit/fhamcrest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function (expand in out rank)
COMMAND ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/multirank.py -i ${in} -o ${out} --rank=${rank}
DEPENDS ${in} ${CMAKE_CURRENT_SOURCE_DIR}/multirank.py
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT Generating ${out}
COMMENT "Generating ${out}"
)
endfunction()

Expand Down
2 changes: 1 addition & 1 deletion tests/fhamcrest/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.12)

set(pf_tests
Test_Core.pf
Expand Down
2 changes: 1 addition & 1 deletion tests/funit-core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.12)

#include_directories (${PFUNIT_SOURCE_DIR}/include)
#include_directories (${PFUNIT_BINARY_DIR}/src)
Expand Down

0 comments on commit cf37fb6

Please sign in to comment.