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


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!


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
  message(FATAL_ERROR "PlPlot library is missing")

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.

This question has already been answered. Start a new discussion instead.