Skip to content

Instantly share code, notes, and snippets.

@aperezdc
Last active July 25, 2019 22:38
Show Gist options
  • Save aperezdc/ff7b912894395e7d5abc451896dc1b5e to your computer and use it in GitHub Desktop.
Save aperezdc/ff7b912894395e7d5abc451896dc1b5e to your computer and use it in GitHub Desktop.
CMake madness
pctest % PKG_CONFIG_PATH=`pwd` cmake .
-- The C compiler identification is GNU 9.1.0
-- The CXX compiler identification is GNU 9.1.0
-- Check for working C compiler: /usr/lib/ccache/bin/cc
-- Check for working C compiler: /usr/lib/ccache/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/lib/ccache/bin/c++
-- Check for working CXX compiler: /usr/lib/ccache/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.6.3")
-- Checking for module 'one'
-- Found one, version 1
PC_INCLUDE_DIRS ... one/include;two/include
PC_CFLAGS ......... -Ione/include;-mmodule=one;-pthread;-Itwo/include;-mmodule=two;-fopenmp
PC_CFLAGS_OTHER ... -mmodule=one;-pthread;-mmodule=two;-fopenmp
PC_LIBRARIES ...... one;two
PC_LINK_LIBRARIES . pkgcfg_lib_PC_one-NOTFOUND;pkgcfg_lib_PC_two-NOTFOUND
PC_LIBRARY_DIS .... one/libdir;two/libdir
PC_LDFLAGS ........ -Lone/libdir;-lone;-Ltwo/libdir;-ltwo
PC_LDFLAGS_OTHER ..
-- Configuring done
-- Generating done
-- Build files have been written to: /home/aperez/pctest
pctest %
cmake_minimum_required (VERSION 2.8)
# projectname is the same as the main-executable
project(pctest)
find_package(PkgConfig)
pkg_check_modules(PC one)
message("PC_INCLUDE_DIRS ... ${PC_INCLUDE_DIRS}")
message("PC_CFLAGS ......... ${PC_CFLAGS}")
message("PC_CFLAGS_OTHER ... ${PC_CFLAGS_OTHER}")
message("PC_LIBRARIES ...... ${PC_LIBRARIES}")
message("PC_LINK_LIBRARIES . ${PC_LINK_LIBRARIES}")
message("PC_LIBRARY_DIS .... ${PC_LIBRARY_DIRS}")
message("PC_LDFLAGS ........ ${PC_LDFLAGS}")
message("PC_LDFLAGS_OTHER .. ${PC_LDFLAGS_OTHER}")
Name: one
Description: One
Version: 1
Requires: two
Cflags: -Ione/include -mmodule=one -pthread
Libs: -Lone/libdir -lone
Name: two
Description: Two
Version: 1
Cflags: -Itwo/include -mmodule=two -fopenmp
Libs: -Ltwo/libdir -ltwo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment