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 and netcdf libraries f90 #56

Open
med2404 opened this issue Jun 10, 2023 · 1 comment
Open

cmake and netcdf libraries f90 #56

med2404 opened this issue Jun 10, 2023 · 1 comment

Comments

@med2404
Copy link

med2404 commented Jun 10, 2023

when i run : ### Cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/pnt/Downloads/bufr/my_bouild_dir

i get this probleme :

CMake Deprecation Warning at CMakeLists.txt:3 (CMAKE_MINIMUM_REQUIRED):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.

-- Found NetCDF: /usr/include (found version "4.8.1")
-- Configuring done
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
NETCDF_LIBRARIES_F90 (ADVANCED)
linked by target "netcdf2littler" in directory /home/pnt/Downloads/bufr/src/netcdf2littler

-- Generating done
CMake Generate step failed. Build files cannot be regenerated correctly.

can you help me to build this programme (netcdflittleR)

@med2404 med2404 changed the title cmake don't fond netcdf cmake and netcdf libraries f90 Jun 10, 2023
@med2404
Copy link
Author

med2404 commented Jun 11, 2023

so i get to netcdf2littler-master/src/netcdf2littler/ to fix the last problem that i pose so run the CMakeLists.txt there
and run make .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/pnt/Downloads/netcdf2littler-master/src/netcdf2littler
and get is problem now

Make Warning (dev) at CMakeLists.txt:13 (ADD_EXECUTABLE):
Policy CMP0037 is not set: Target names should not be reserved and should
match a validity pattern. Run "cmake --help-policy CMP0037" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.

The target name "/check_status.f90" is reserved or not valid for certain
CMake features, such as generator expressions, and may result in undefined
behavior.

Make Error at CMakeLists.txt:23 (TARGET_LINK_LIBRARIES):
TARGET_LINK_LIBRARIES called with incorrect number of arguments

########################################
# Set up how to compile the source files
########################################

# Add the source files
SET(NETCDF2LITTLER_src ${SRCNETCDF2LITTLER}/check_status.f90
                       ${SRCNETCDF2LITTLER}/netcdf2littler.f90
                       ${SRCNETCDF2LITTLER}/logging.f90
                       ${SRCNETCDF2LITTLER}/readncdf.f90
                       ${SRCNETCDF2LITTLER}/write_littler.f90
)

ADD_EXECUTABLE(${NETCDF2LITTLEREXE} ${NETCDF2LITTLER_src})

#####################################################
# Add the needed libraries and special compiler flags
#####################################################

# This links foo to the f_udunits_2 library
INCLUDE_DIRECTORIES(${NETCDF_INCLUDES}
                    ${FUDUNITS2_INCLUDES})

TARGET_LINK_LIBRARIES(${NETCDF2LITTLEREXE} ${FUDUNITS2LIB}
                      ${UDUNITS2_LIBRARIES} 
                      ${NETCDF_LIBRARIES_F90})


#####################################
# Tell how to install this executable
#####################################

IF(WIN32)
    SET(CMAKE_INSTALL_PREFIX "C:\\Program Files")
ELSE()
    SET(CMAKE_INSTALL_PREFIX /usr/local)
ENDIF(WIN32)

# install binary
INSTALL(TARGETS ${NETCDF2LITTLEREXE} RUNTIME DESTINATION bin)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant