{"id":19867708,"url":"https://github.com/cwsmith/cmakenetcdfpkgconfig","last_synced_at":"2026-06-10T12:31:07.290Z","repository":{"id":93888956,"uuid":"255599091","full_name":"cwsmith/cmakeNetcdfPkgConfig","owner":"cwsmith","description":"Demonstrates linking problem using Cmake PkgConfig for NetCDF and NetCDF-CXX4","archived":false,"fork":false,"pushed_at":"2020-04-14T12:53:38.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-01T00:39:14.453Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cwsmith.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-14T12:10:10.000Z","updated_at":"2020-04-14T12:53:41.000Z","dependencies_parsed_at":"2023-04-26T15:02:42.257Z","dependency_job_id":null,"html_url":"https://github.com/cwsmith/cmakeNetcdfPkgConfig","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cwsmith/cmakeNetcdfPkgConfig","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cwsmith%2FcmakeNetcdfPkgConfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cwsmith%2FcmakeNetcdfPkgConfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cwsmith%2FcmakeNetcdfPkgConfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cwsmith%2FcmakeNetcdfPkgConfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cwsmith","download_url":"https://codeload.github.com/cwsmith/cmakeNetcdfPkgConfig/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cwsmith%2FcmakeNetcdfPkgConfig/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34153482,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T15:30:04.487Z","updated_at":"2026-06-10T12:31:07.274Z","avatar_url":"https://github.com/cwsmith.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cmakeNetcdfPkgConfig\nDemonstrates linking problem using CMake PkgConfig `pkg_check_modules` to import NetCDF\nand NetCDF-CXX4 targets when using the wrong `cmake_minimum_version`.\n\nUsing `cmake_minimum_version(VERSION 3.00.0)` and imported targets from \nPkgConfig via\n`target_link_libraries(foo PkgConfig::NetCDF PkgConfig::NetCDF-CXX4)`\nresults in the following linking error:\n\n```\n$ make \nScanning dependencies of target foo\n[ 50%] Building CXX object CMakeFiles/foo.dir/foo.cpp.o\n[100%] Linking CXX executable foo\n/gpfs/u/software/dcs-spack-install/v0133gccSpectrum/linux-rhel7-power9le/gcc-7.4.0-1/netcdf-cxx4-4.3.1-7lwefeghu3za7l46xhlezrgdrhgrddq4/lib/libnetcdf_c++4.so:\nundefined reference to `nc_inq_var_filter'\n/gpfs/u/software/dcs-spack-install/v0133gccSpectrum/linux-rhel7-power9le/gcc-7.4.0-1/netcdf-cxx4-4.3.1-7lwefeghu3za7l46xhlezrgdrhgrddq4/lib/libnetcdf_c++4.so:\nundefined reference to `nc_def_var_filter'\ncollect2: error: ld returned 1 exit status\nmake[2]: *** [foo] Error 1\nmake[1]: *** [CMakeFiles/foo.dir/all] Error 2\n```\n\nUsing `cmake_minimum_version(VERSION 3.13.0)` will result in successful\nlinking.\n\n## contents\n\n- CMakeLists.txt: build file\n- foo.cpp: netcdfcxx source code\n- LICENSE: legal stuff\n- README.md: this file\n- netcdfPkgConfig: directory with netcdf pkgconfig files\n  - netcdf-cxx4.pc\n  - netcdf.pc\n\n## setup\n\nUse spack to install netcdf and netcdf-cxx4.\n\n```\ngit clone https://github.com/spack/spack.git\ncd spack\ngit checkout v0.13.3\nexport SPACK_ROOT=$PWD/spack/\nexport PATH=$SPACK_ROOT/bin:$PATH\nsource $SPACK_ROOT/share/spack/setup-env.sh\n#setup compilers and packages if needed\nspack install netcdf-cxx4@4.3.1 ^netcdf@4.7.2+parallel-netcdf ^hdf5+hl+cxx\n```\n\nThis will create the pkgconfig files located in the `netcdfPkgConfig` directory.\n\n## build the example package\n\n```\nncDir=`spack location -i netcdf@4.7.2`\nncxxDir=`spack location -i netcdf-cxx4@4.3.1`\nexport PKG_CONFIG_PATH=\\\n$PKG_CONFIG_PATH:\\\n${ncDir}/lib/pkgconfig:\\\n${ncxxDir}/lib/pkgconfig\n# setup compiler (i.e., module load ...)\ngit clone https://github.com/cwsmith/cmakeNetcdfPkgConfig.git\nmkdir build-cmakeNetcdfPkgConfig\ncd !$\ncmake ../cmakeNetcdfPkgConfig\nmake\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcwsmith%2Fcmakenetcdfpkgconfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcwsmith%2Fcmakenetcdfpkgconfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcwsmith%2Fcmakenetcdfpkgconfig/lists"}