[CMake] cmake version/feature detection

2014-08-04 Thread Leif Walsh
Hi, I'm wondering what is the best way to do feature detection or version checking of cmake itself, in cmake. In particular, I'd like to check for the OBJECT library feature and either use it or fall back to our current mechanism if we're using an older cmake. -- Cheers, Leif -- Powered by ww

Re: [CMake] Settings different flags in sub projects

2014-08-04 Thread David Zemon
Poking around some more I think I may have found a better solution. # Toolchain file include(FileWithInitFlags.cmake) set(CMAKE_C_COMPILE_OBJECT " ${CMAKE_C_FLAGS_INIT} -o -c ") And for the custom languages I can add that to CMakeInformation.cmake. I'm not sure why I didn't th

Re: [CMake] Settings different flags in sub projects

2014-08-04 Thread David Zemon
Glenn, thanks for the tip. Those two options are new to me. It's not very clear to me how the add_compile_options function works. Complexity might be added when I mention that I've also defined 4 new custom languages (all essentially identical to C). When add_compile_options is executed, will

[CMake] Possible bug install(EXPORT ...) and 'DIRECTORY .' & questions regarding Config file authoring

2014-08-04 Thread Walter Gray
I've been trying to figure out how to correctly author install steps for a library that will generate a self-contained folder that can be distributed and used by others, including a good Config.cmake file and I ran into what seems like a bug. If you say install(EXPORT DESTINATION .) Then th

Re: [CMake] Settings different flags in sub projects

2014-08-04 Thread Glenn Coombs
Something like this should work: add_compile_options(-std=c99) set_property(DIRECTORY "/root/p1" PROPERTY COMPILE_OPTIONS "-Os") set_property(DIRECTORY "/root/p2" PROPERTY COMPILE_OPTIONS "-O1") or you just use the add_compile_options command in all 3 CMakeLists.txt files. The CMakeLists.txt f

Re: [CMake] Fwd: set_target_properties and language specific COMPILE_FLAGS

2014-08-04 Thread Nicolas Bock
The solution is to add the POSITION_INDENPENDENT_CODE target property to the C and Fortran convenience library targets. Thanks again for the help, nick On Mon, Aug 4, 2014 at 3:35 PM, Nicolas Bock wrote: > Hi Chuck, > > I am building both static and shared libraries using the object files. > Af

Re: [CMake] Fwd: set_target_properties and language specific COMPILE_FLAGS

2014-08-04 Thread Nicolas Bock
Hi Chuck, I am building both static and shared libraries using the object files. After splitting the Fortran and C source as you suggest, I get the following linker error: /usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../x86_64-pc-linux-gnu/bin/ld: CMakeFiles/spammpack-serial-C.dir/spamm_get_ti

Re: [CMake] Fwd: set_target_properties and language specific COMPILE_FLAGS

2014-08-04 Thread Nicolas Bock
Hi Chuck, seems a bit hackish, but works for me :) Thanks for the trick! nick On Fri, Aug 1, 2014 at 12:37 PM, Chuck Atkins wrote: > Hi Nick, > > You could split your target in to two object libraries that combine into a > singe "real" library: > > add_library(foo_f OBJECT ${FOO_F_SOURCES}) >

[CMake] CPack patch version getting set erroneously...

2014-08-04 Thread Richard Shaw
I converted a project from autotools/handmade makefiles to cmake and afterwards I added NSIS packaging for win32 builds via the cpack integration. Everything was fine while the version patch level was being used, but upon the next release "0.97" w/o a patch level the resultant installer has the sh

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