[CMake] Help cmake First project

Rodrigo Faccioli rodrigo.faccioli at gmail.com
Mon Aug 4 10:26:03 EDT 2014


Hi,

I'm trying to use cmake in my project. In fact, it is my first time using
cmake.

My CmakeList file is below. You can see it is very simple because I'm
trying to compile a binary.

cmake_minimum_required(VERSION 2.8)

project(2pg_cartesian)
set(PROJECT_VERSION "1.0")

include_directories(${2pg_cartesian_SOURCE_DIR}/include)

add_executable(protpred-Gromacs-NSGA2
${2pg_cartesian_SOURCE_DIR}/src/protpred-Gromacs-NSGA2.c)

install(TARGETS protpred-Gromacs-NSGA2 DESTINATION bin)

When I run cmake .. I receive  Build files have been written to:
/home/faccioli/Downloads/2pg_cartesian/build. I understand that all is ok.

faccioli at faccioli:~/Downloads/2pg_cartesian/build$ cmake ..
-- The C compiler identification is GNU 4.7.2
-- The CXX compiler identification is GNU 4.7.2
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to:
/home/faccioli/Downloads/2pg_cartesian/build
faccioli at faccioli:~/Downloads/2pg_cartesian/build$

However, when I run make, I receive an error message as below:

faccioli at faccioli:~/Downloads/2pg_cartesian/build$ make
Scanning dependencies of target protpred-Gromacs-NSGA2
[100%] Building C object
CMakeFiles/protpred-Gromacs-NSGA2.dir/src/protpred-Gromacs-NSGA2.c.o
Linking C executable protpred-Gromacs-NSGA2
CMakeFiles/protpred-Gromacs-NSGA2.dir/src/protpred-Gromacs-NSGA2.c.o: In
function `main':
protpred-Gromacs-NSGA2.c:(.text+0x1e): undefined reference to `display_msg'
protpred-Gromacs-NSGA2.c:(.text+0x3e): undefined reference to
`load_parameters_from_file'
protpred-Gromacs-NSGA2.c:(.text+0x58): undefined reference to `ea_nsga2'
protpred-Gromacs-NSGA2.c:(.text+0x64): undefined reference to `fatal_error'
protpred-Gromacs-NSGA2.c:(.text+0x73): undefined reference to
`deAllocateload_parameters'
protpred-Gromacs-NSGA2.c:(.text+0x7d): undefined reference to `display_msg'
collect2: error: ld returned 1 exit status
make[2]: ** [protpred-Gromacs-NSGA2] Erro 1
make[1]: ** [CMakeFiles/protpred-Gromacs-NSGA2.dir/all] Erro 2
make: ** [all] Erro 2
faccioli at faccioli:~/Downloads/2pg_cartesian/build$

Could you help me understand how can I fix this problem?

I appreciate any help.

Best regards,

--
Rodrigo Antonio Faccioli, Ph.D
Development Software for Structural Bioinformatics
Barao de Maua University
University of Sao Paulo
Lindedin - br.linkedin.com/pub/rodrigo-antonio-faccioli/7/589/a5/
Curriculum Lattes - http://lattes.cnpq.br/1025157978990218
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20140804/4f972838/attachment.html>


More information about the CMake mailing list