Thanks Chuck and Angeliki. Thanks your help. However, unfortunatelly, I couldn't fix.
In [1] I show all my project. In src directory there is all .c files. In include directory there is .h files. The protpred-Gromacs-NSGA2.c is one of executable. The others are: protpred-Gromacs-Dominance.c, protpred-Gromacs-Front.c, protpred-Gromacs-MC_Metropolis.c, protpred-Gromacs-Mono.c, protpred-Gromacs-Random_Algorithm.c. All executable share the include directory. In [2] contains my Makefile that I have already used in my project. Therefore, I would like to build this make file using cmake. Furthermore, I would compile in windows too. Because of this, I have studied cmake. My doubt is how can I build CMakeList.txt. I appreciate any help. [1] https://dl.dropboxusercontent.com/u/4270818/2pg_cartesian_cmake.zip [2] https://dl.dropboxusercontent.com/u/4270818/Makefile 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 On Mon, Aug 4, 2014 at 11:53 AM, Chuck Atkins <chuck.atk...@kitware.com> wrote: > Hi Rodrigo, > > It looks like you are probably missing some source files in your > executable. Is protpred-Gromacs-NSGA2.c the only piece of code that gets > built for the executable? If not, you'll need to make sure that all the > necessary source files get either built into the executable or build as a > separate library and linked into the executable. Also, you can simply your > CMakeLists.txt and clean it up a bit by leaving out the > ${2pg_cartesian_SOURCE_DIR} in most commands since CMake looks in the > current directory of the CMakeLists.txt file by default for most of its > functions: > > include_directories(include) > add_executable(protpred-Gromacs-NSGA2 src/protpred-Gromacs-NSGA2.c) > install(TARGETS protpred-Gromacs-NSGA2 DESTINATION bin) > > > - Chuck > > > On Mon, Aug 4, 2014 at 10:26 AM, Rodrigo Faccioli < > rodrigo.facci...@gmail.com> wrote: > >> 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@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@faccioli:~/Downloads/2pg_cartesian/build$ >> >> However, when I run make, I receive an error message as below: >> >> faccioli@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@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 >> >> -- >> >> 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 >> > >
-- 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