Thanks, Mike!

HNG

On Thu, Mar 23, 2017 at 12:59 PM, Michael Ellery <mellery...@gmail.com> wrote:
>
>> On Mar 22, 2017, at 2:07 PM, Hom Nath Gharti <hng.em...@gmail.com> wrote:
>>
>> Dear all,
>>
>> I use PETSc in my package and I need to use the following line in my
>> GNU Makefile:
>>
>> include ${PETSC_DIR}/lib/petsc/conf/variables
>>
>> What is the equivalent command for CMakeLists.txt for this?
>>
>> Thanks for your help.
>>
>> Thanks,
>> HNG
>> --
>
> The typical way to use an installed library is via find_package, which 
> requires either a pkgspec or a find module. It looks like someone has already 
> written a find module:
>
> https://github.com/jedbrown/cmake-modules/blob/master/FindPETSc.cmake
>
> so, you can do something like:
>
> * fork/or submodule this repo above
> * append to CMAKE_MODULE_PATH in your CMakeLists.txt file to add the path to 
> this module above.
> * call find_package(PETSc)
> * use the variables that are documented in the finder to set your 
> include_directories and target_link_libraries.
>
> If you are certain the env variable PETSC_DIR is always going to be set (as 
> above), then you can simply build paths based on that variable and pass them 
> to include_directories and target_link_libraries, but the finders also do a 
> better job of dealing with various build environments, etc.
>
> HTH,
> Mike Ellery
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to