Re: [CMake] Help cmake First project

2014-08-13 Thread Chuck Atkins
Are these actually C++ files? If so then they should really have a C++ extension (like .cp or .cxx). It may be a good idea in general since other build tools may run in to the same sort of issue of assuming they are C files. A few other tips: first, by placing all your source files in a list var

Re: [CMake] Help cmake First project

2014-08-11 Thread Rodrigo Faccioli
Hi, Angeliki, thanks your comments. I used properties because my old makefile was written to use g++ despite my files have suffix .c. I understood that cmake tried to compile my files using gcc instead of g++. I removed my set compiler flags. Moreover, I have finished to compile all programs of

Re: [CMake] Help cmake First project

2014-08-06 Thread Angeliki Chrysochou
Hi Rodrigo, Glad that it is working for you now. I just wanted to mention that I never had to set the language as properties to the source files since cmake detects it from the suffix of the source files you list, or at least I never had a case where the language was not properly detected. Other

Re: [CMake] Help cmake First project

2014-08-05 Thread Hendrik Sattler
Hi, -lm does not belong to CMAKE_CXX_FLAGS as it is a linker option to link libm. Use target_link_libraries(protpred-Gromacs-NSGA2 m) instead. (Don't search for libm, the linker knows where it is.) It is also more common to use a variable for the list of source files. That would make it also pos

Re: [CMake] Help cmake First project

2014-08-05 Thread Rodrigo Faccioli
Hi, I am thankfull for all help. Now, it is working :-) Radovan, thank you to try to run and your comments. 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 execu

Re: [CMake] Help cmake First project

2014-08-05 Thread Rodrigo Faccioli
Hi, Thanks Angeliki and Bill for your attentation. I have updated my CMakeList.txt based on your post. Below my CMakeList.txt is showed. cmake_minimum_required(VERSION 2.8) # project Information project(2pg_cartesian) set(PROJECT_VERSION "1.0") # add definitions to compiler add_definitions(-std=

Re: [CMake] Help cmake First project

2014-08-04 Thread Bill Hoffman
On 8/4/2014 10:26 AM, Rodrigo Faccioli wrote: 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-Gro

Re: [CMake] Help cmake First project

2014-08-04 Thread Angeliki Chrysochou
Hi Rodrigo, You have to state to cmake all of your source files for compilation, otherwise they won't be found in the generated makefiles. You can do this either by writing all file names individually in add_executable, or create a variable or a list that contains all of the file names, or assign

Re: [CMake] Help cmake First project

2014-08-04 Thread Rodrigo Faccioli
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, pro

Re: [CMake] Help cmake First project

2014-08-04 Thread Chuck Atkins
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

Re: [CMake] Help cmake First project

2014-08-04 Thread Angeliki Chrysochou
Hi Rodrigo, Where is the implementation of the undefined references? If it is in another source file (other than protpred-Gromacs-NSGA2.c, which seems to be the only one you are compiling) you should add it to the compilation. If it is in another library that is already compiled, you should add i

[CMake] Help cmake First project

2014-08-04 Thread Rodrigo Faccioli
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