Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake Correctly set generated property on autogen source code #2132

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
cmake_minimum_required( VERSION 3.20 )
cmake_policy( SET CMP0118 NEW )
cmake_minimum_required( VERSION 3.19 )

enable_language( C )
enable_language( CXX )
Expand Down
8 changes: 1 addition & 7 deletions cmake/c_preproc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,13 @@ macro( wrf_c_preproc_fortran )
# # It keeps getting better lol
# # https://gitlab.kitware.com/cmake/cmake/-/issues/18399
# # We could use cmake 3.20+ and CMP0118, but this allows usage from 3.18.6+
# TL;DR - This doesn't work despite all documentation stating otherwise, need to use CMP0118
# set_source_files_properties(
# ${WRF_PP_F_OUTPUT_FILE}
# ${WRF_PP_F_TARGET_DIRECTORY}
# PROPERTIES
# GENERATED TRUE
# )
set_source_files_properties(
${WRF_PP_F_OUTPUT_FILE}
DIRECTORY ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${WRF_PP_F_TARGET_DIRECTORY}
PROPERTIES
Fortran_PREPROCESS OFF
GENERATED TRUE
)
# message( STATUS "File ${WRF_PP_F_SOURCE_FILE} will be preprocessed into ${WRF_PP_F_OUTPUT_FILE}" )

Expand Down
8 changes: 1 addition & 7 deletions cmake/m4_preproc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,13 @@ macro( wrf_m4_preproc_fortran )
# # It keeps getting better lol
# # https://gitlab.kitware.com/cmake/cmake/-/issues/18399
# # We could use cmake 3.20+ and CMP0118, but this allows usage from 3.18.6+
# TL;DR - This doesn't work despite all documentation stating otherwise, need to use CMP0118
# set_source_files_properties(
# ${WRF_PP_M4_OUTPUT_FILE}
# ${WRF_PP_M4_TARGET_DIRECTORY}
# PROPERTIES
# GENERATED TRUE
# )
set_source_files_properties(
${WRF_PP_M4_OUTPUT_FILE}
DIRECTORY ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${WRF_PP_M4_TARGET_DIRECTORY}
PROPERTIES
Fortran_PREPROCESS OFF
GENERATED TRUE
)
# message( STATUS "File ${WRF_PP_M4_SOURCE_FILE} will be preprocessed into ${WRF_PP_M4_OUTPUT_FILE}" )

Expand Down
3 changes: 2 additions & 1 deletion frame/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ endif()
target_sources(
${PROJECT_NAME}_Core
PRIVATE
${WRF_INCLUDE_FILES}
module_internal_header_util.F


module_configure.F
module_driver_constants.F
Expand Down
9 changes: 9 additions & 0 deletions tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,15 @@ add_custom_target(
${allocs_source}
)

set_source_files_properties(
${CMAKE_BINARY_DIR}/frame/module_state_description.F
${dealloc_source}
${allocs_source}
DIRECTORY ${PROJECT_SOURCE_DIR}
PROPERTIES
GENERATED TRUE
)

target_sources(
${PROJECT_NAME}_Core
PRIVATE
Expand Down