<div dir="ltr">Hi,<div><br></div><div>I am thankfull for all help. Now, it is working :-)</div><div><br></div><div>Radovan, thank you to try to run and your comments. <br></div><div><br></div><div>My CMakeList.txt is showed below. I would like to know about best practice to make a CMakeList. If agree, I will compile others executables of my project based on how I compiled this executable. In [1] contains my full project. <br>
</div><div><br></div><div>cmake_minimum_required(VERSION 2.8)</div><div><br></div><div># project Information </div><div>project(2pg_cartesian)</div><div>set(PROJECT_VERSION "1.0")</div><div><br></div><div># Set compiler flags</div>
<div>SET ( CMAKE_CXX_FLAGS "-lm -pedantic")</div><div><br></div><div>#Set CXX compiler for all files below</div><div>set_source_files_properties(include/LoadConfig.h PROPERTIES LANGUAGE CXX )</div><div>set_source_files_properties(src/protpred-Gromacs-NSGA2.c  PROPERTIES LANGUAGE CXX )</div>
<div>set_source_files_properties(src/LoadConfig.cpp  PROPERTIES LANGUAGE CXX )</div><div>set_source_files_properties(src/ea_mono.c  PROPERTIES LANGUAGE CXX )</div><div>set_source_files_properties(src/topology.c  PROPERTIES LANGUAGE CXX )</div>
<div>set_source_files_properties(src/pdbio.c  PROPERTIES LANGUAGE CXX )</div><div>set_source_files_properties(src/protein.c  PROPERTIES LANGUAGE CXX )</div><div>set_source_files_properties(src/futil.c  PROPERTIES LANGUAGE CXX )</div>
<div>set_source_files_properties(src/pdbatom.c  PROPERTIES LANGUAGE CXX )</div><div>set_source_files_properties(src/messages.c  PROPERTIES LANGUAGE CXX )</div><div>set_source_files_properties(src/topologyio.c  PROPERTIES LANGUAGE CXX )</div>
<div>set_source_files_properties(src/topologylib.c  PROPERTIES LANGUAGE CXX )</div><div>set_source_files_properties(src/randomlib.c  PROPERTIES LANGUAGE CXX )</div><div>set_source_files_properties(src/vector_math.c  PROPERTIES LANGUAGE CXX )</div>
<div>set_source_files_properties(src/string_owner.c  PROPERTIES LANGUAGE CXX )</div><div>set_source_files_properties(src/math_owner.c   PROPERTIES LANGUAGE CXX )</div><div>set_source_files_properties(src/osutil.c   PROPERTIES LANGUAGE CXX )</div>
<div>set_source_files_properties(src/load_parameters.c  PROPERTIES LANGUAGE CXX )</div><div>set_source_files_properties(src/objective.c  PROPERTIES LANGUAGE CXX )</div><div>set_source_files_properties(src/aminoacids.c  PROPERTIES LANGUAGE CXX )</div>
<div>set_source_files_properties(src/aminoacids_io.c  PROPERTIES LANGUAGE CXX )</div><div>set_source_files_properties(src/populationio.c  PROPERTIES LANGUAGE CXX )</div><div>set_source_files_properties(src/rotation.c  PROPERTIES LANGUAGE CXX )</div>
<div>set_source_files_properties(src/solution.c  PROPERTIES LANGUAGE CXX )</div><div>set_source_files_properties(src/gromacs_objectives.c  PROPERTIES LANGUAGE CXX )</div><div>set_source_files_properties(src/solutionio.c  PROPERTIES LANGUAGE CXX )</div>
<div>set_source_files_properties(src/algorithms.c  PROPERTIES LANGUAGE CXX )</div><div>set_source_files_properties(src/ea_nsga2.c  PROPERTIES LANGUAGE CXX )</div><div>set_source_files_properties(src/dominance.c PROPERTIES LANGUAGE CXX )</div>
<div><br></div><div># set include</div><div>include_directories(include)</div><div><br></div><div># add libries</div><div>add_library(2PG-NSGA2_lib STATIC </div><div>src/LoadConfig.cpp </div><div>src/ea_mono.c </div><div>
src/topology.c </div><div>src/pdbio.c </div><div>src/protein.c </div><div>src/futil.c </div><div>src/pdbatom.c </div><div>src/messages.c </div><div>src/topologyio.c </div><div>src/topologylib.c </div><div>src/randomlib.c </div>
<div>src/vector_math.c </div><div>src/string_owner.c </div><div>src/math_owner.c  </div><div>src/osutil.c  </div><div>src/load_parameters.c </div><div>src/objective.c </div><div>src/aminoacids.c </div><div>src/aminoacids_io.c </div>
<div>src/populationio.c <span class="" style="white-space:pre"> </span></div><div>src/rotation.c </div><div>src/solution.c </div><div>src/gromacs_objectives.c </div><div>src/solutionio.c </div><div>src/algorithms.c </div>
<div>src/ea_nsga2.c </div><div>src/dominance.c</div><div>) #end of 2PG-NSGA2_lib</div><div><br></div><div># add target</div><div>add_executable(protpred-Gromacs-NSGA2 src/protpred-Gromacs-NSGA2.c)</div><div>target_link_libraries(protpred-Gromacs-NSGA2 2PG-NSGA2_lib)</div>
<div><br></div><div># install</div><div>install(TARGETS protpred-Gromacs-NSGA2 DESTINATION bin)</div><div><br></div><div>[1] <a href="https://dl.dropboxusercontent.com/u/4270818/2pg_cartesian_cmake.zip">https://dl.dropboxusercontent.com/u/4270818/2pg_cartesian_cmake.zip</a> </div>
<div><br></div><div>Best regards,</div></div><div class="gmail_extra"><br clear="all"><div><div dir="ltr">--<br>Rodrigo Antonio Faccioli, Ph.D<br>Development Software for Structural Bioinformatics<br>Barao de Maua University<div>
University of Sao Paulo<br><div>Lindedin - <a href="http://br.linkedin.com/pub/rodrigo-antonio-faccioli/7/589/a5/" title="View public profile" name="SafeHtmlFilter_webProfileURL" target="_blank">br.linkedin.com/pub/rodrigo-antonio-faccioli/7/589/a5/</a><br>
Curriculum Lattes - <a href="http://lattes.cnpq.br/1025157978990218" target="_blank">http://lattes.cnpq.br/1025157978990218</a><br></div></div></div></div>
<br><br><div class="gmail_quote">On Tue, Aug 5, 2014 at 3:39 PM, radovan bast <span dir="ltr"><<a href="mailto:bast@kth.se" target="_blank">bast@kth.se</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">dear Rodrigo,<div><br></div><div>i tried it but ran into many other problems in the source, not cmake.</div><div><br></div><div>but also some cmake suggestions:</div><div>- list the language(s) that the project uses</div>

<div>- the c99 flag is not a definition but a compiler flag, use CMAKE_CXX_FLAGS_... for portability</div><div>- "ALL" is not a good library name</div><div>- i recommend to not glob sources but to list them explicitly, there are several discussions on the net</div>

<div>  which explain why if you search for the topic</div><div><br></div><div>good luck!</div><div>  radovan</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Aug 5, 2014 at 5:08 PM, Rodrigo Faccioli <span dir="ltr"><<a href="mailto:rodrigo.faccioli@gmail.com" target="_blank">rodrigo.faccioli@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi,</div><div><br></div><div>Thanks Angeliki and Bill for your attentation.</div><div><br></div><div>

I have updated my CMakeList.txt based on your post. Below my CMakeList.txt is showed.</div><div><br></div>
<div>cmake_minimum_required(VERSION 2.8)</div><div># project Information </div><div>project(2pg_cartesian)</div><div>set(PROJECT_VERSION "1.0")</div><div># add definitions to compiler</div><div>add_definitions(-std=c99)</div>


<div># get all files under directory src</div><div>file(GLOB SRC_FILES "src/*.c")</div><div># set include</div><div>include_directories(include)</div><div># added libries</div><div>add_library(ALL STATIC ${SRC_FILES})</div>


<div># add target</div><div>add_executable(protpred-Gromacs-NSGA2 src/protpred-Gromacs-NSGA2.c)</div><div>target_link_libraries(protpred-Gromacs-NSGA2 ALL)</div><div><br></div><div>Unfortunatelly, I have received error messages as cited below:</div>


<div><div>faccioli@faccioli:~/Downloads/2pg_cartesian/build$ make</div><div>Scanning dependencies of target ALL</div><div>[  2%] Building C object CMakeFiles/ALL.dir/src/protpred-Gromacs-NSGA2.c.o</div><div>[  5%] Building C object CMakeFiles/ALL.dir/src/ea_mono.c.o</div>


<div>[  7%] Building C object CMakeFiles/ALL.dir/src/topologyio.c.o</div><div>[ 10%] Building C object CMakeFiles/ALL.dir/src/aminoacids.c.o</div><div>[ 12%] Building C object CMakeFiles/ALL.dir/src/populationio.c.o</div>


<div>[ 15%] Building C object CMakeFiles/ALL.dir/src/osutil.c.o</div><div>[ 17%] Building C object CMakeFiles/ALL.dir/src/aminoacids_io.c.o</div><div>[ 20%] Building C object CMakeFiles/ALL.dir/src/protpred-Gromacs-Sort_Method_Files_by_Front_Dominance.c.o</div>


<div>[ 23%] Building C object CMakeFiles/ALL.dir/src/pdbio.c.o</div><div>[ 25%] Building C object CMakeFiles/ALL.dir/src/solution.c.o</div><div>[ 28%] Building C object CMakeFiles/ALL.dir/src/vector_math.c.o</div><div>[ 30%] Building C object CMakeFiles/ALL.dir/src/math_owner.c.o</div>


<div>[ 33%] Building C object CMakeFiles/ALL.dir/src/protein.c.o</div><div>[ 35%] Building C object CMakeFiles/ALL.dir/src/load_parameters.c.o</div><div>In file included from /home/faccioli/Downloads/2pg_cartesian/src/load_parameters.c:7:0:</div>


<div>/home/faccioli/Downloads/2pg_cartesian/include/LoadConfig.h:1:18: fatal error: string: Arquivo ou diretório não encontrado</div><div>compilation terminated.</div><div>make[2]: ** [CMakeFiles/ALL.dir/src/load_parameters.c.o] Erro 1</div>


<div>make[1]: ** [CMakeFiles/ALL.dir/all] Erro 2</div><div>make: ** [all] Erro 2</div><div>faccioli@faccioli:~/Downloads/2pg_cartesian/build$</div></div><div><br></div><div>I did not understand what mistakes I have done since all files share same structure of directory. In [1] is my project completly. If prefer I can send its github repository.</div>


<div><br></div><div>I appreciate any help.<br></div><div><br></div><div>Best regards,</div><div><br></div><div>[1] <a href="https://dl.dropboxusercontent.com/u/4270818/2pg_cartesian_cmake.zip" target="_blank">https://dl.dropboxusercontent.com/u/4270818/2pg_cartesian_cmake.zip</a></div>


<div><br></div></div><div class="gmail_extra"><br clear="all"><div><div dir="ltr">--<br>Rodrigo Antonio Faccioli, Ph.D<br>Development Software for Structural Bioinformatics<br>Barao de Maua University<div>University of Sao Paulo<br>


<div>Lindedin - <a href="http://br.linkedin.com/pub/rodrigo-antonio-faccioli/7/589/a5/" title="View public profile" name="147a778063f5b010_147a6b6f6056a852_SafeHtmlFilter_webProfileURL" target="_blank">br.linkedin.com/pub/rodrigo-antonio-faccioli/7/589/a5/</a><br>


Curriculum Lattes - <a href="http://lattes.cnpq.br/1025157978990218" target="_blank">http://lattes.cnpq.br/1025157978990218</a><br></div></div></div></div>
<br><br><div class="gmail_quote">On Mon, Aug 4, 2014 at 12:54 PM, Bill Hoffman <span dir="ltr"><<a href="mailto:bill.hoffman@kitware.com" target="_blank">bill.hoffman@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div>On 8/4/2014 10:26 AM, Rodrigo Faccioli wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
protpred-Gromacs-NSGA2.c:(.<u></u>text+0x1e): undefined reference to `display_msg'<br>
protpred-Gromacs-NSGA2.c:(.<u></u>text+0x3e): undefined reference to<br>
`load_parameters_from_file'<br>
protpred-Gromacs-NSGA2.c:(.<u></u>text+0x58): undefined reference to `ea_nsga2'<br>
protpred-Gromacs-NSGA2.c:(.<u></u>text+0x64): undefined reference to `fatal_error'<br>
protpred-Gromacs-NSGA2.c:(.<u></u>text+0x73): undefined reference to<br>
`deAllocateload_parameters'<br>
protpred-Gromacs-NSGA2.c:(.<u></u>text+0x7d): undefined reference to `display_msg'<br>
</blockquote></div>
You have to find out where these symbols are defined.  If you have a working Makefile version use nm and grep to find the places.   You can also grep your source tree.  You are either missing a source file, or a -D option.<br>



<br>
Another approach is to run make VERBOSE=1 and compare the build command lines to your Makefile build.<span><font color="#888888"><br>
<br>
-Bill</font></span><div><div><br>
-- <br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/<u></u>CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">http://cmake.org/cmake/help/<u></u>support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/<u></u>consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">http://cmake.org/cmake/help/<u></u>training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/<u></u>opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" target="_blank">http://public.kitware.com/<u></u>mailman/listinfo/cmake</a><br>
</div></div></blockquote></div><br></div>
<br>--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br></blockquote></div><br></div><br clear="all"><div><br></div></div></div><span class="HOEnZb"><font color="#888888">-- <br>
<div dir="ltr"><div># PDC Center for High Performance Computing &</div>
<div># Department of Theoretical Chemistry and Biology </div><div># Royal Institute of Technology, Stockholm</div><div># <a href="tel:%2B46-8-790-6628" value="+4687906628" target="_blank">+46-8-790-6628</a></div></div>
</font></span></blockquote></div><br></div>