Hi all,
I have a silly question regarding how to translate this command in CMakeLists.txt

g++ x04.cc -o demo -lplplotcxxd

x04.cc is c++ file , information about lplplotcxxd can be found here

http://ubuntuforums.org/showthread.php?p=8538977

since the command " g++ x04.cc -o demo -lplplotcxxd" is working on my computer so
I think I have all necessary stuff for plplot.
I use cmake rather than g++ to create executable so if anyone can help me with
this silly problem I will really appreciate it!

Thanks
Ravi

Recommended Answers

All 2 Replies

The important lines would be something like this:

cmake_minimum_required (VERSION 2.6)

add_executable(demo "x04.cc")

find_library(PLPLOT_LIB NAMES plplotcxxd PATHS "/usr/lib/") #or some other path
if(NOT PLPLOT)
  message(FATAL_ERROR "PlPlot library is missing")
endif()

target_link_library(demo ${PLPLOT})

Note that you should probably follow a cmake tutorial because there are many more things you might want to do with cmake, link specify an include directory(ies), specify installation paths for targets, libraries and headers, include sub-directories with other CMakeLists.txt files, etc. etc.

Thanks it really helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.