Re: [netcdfgroup] CMake integration with NetCDF

On 10/04/2012 11:46 AM, Orion Poplawski wrote:
On 10/03/2012 11:48 AM, Ward Fisher wrote:
On 10/2/12 9:04 PM, Orion Poplawski wrote:
On 10/02/2012 10:16 AM, Ward Fisher wrote:
The CMake-integrated source code is not yet part of an official release,
but it may be
checked out from our public subversion repository:

svn checkout http://svn.unidata.ucar.edu/repos/netcdf/trunk netcdf

CMake 2.8.8+ is required. CMake may be downloaded from
http://www.cmake.org.  Instructions
for building NetCDF-C with CMake are described in the
'COMPILE_CMAKE.txt' file found in
the root NetCDF-C directory, or at

http://www.unidata.ucar.edu/software/netcdf/CompileCMake.html.


Looks like some issues with not using -fPIC on x86_64:

This has been fixed on x86_64 bit linux systems, thanks for pointing it out!
Additionally, shared libraries are now properly built by default, and the
BUILD_SHARED_LIBS option should be visible when building using a
CMake GUI front-end.

-Ward

Testing with revision 2631.  Looks like a stray ";" was introduced in front of
the -fPIC:

cd /builddir/build/BUILD/netcdf-4.2.1/build/libsrc && /usr/lib64/ccache/gcc
-DCURL_STATICLIB=1 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4  -m64 -mtune=generic ;-fPIC
-I/builddir/build/BUILD/netcdf-4.2.1/build/libsrc
-I/builddir/build/BUILD/netcdf-4.2.1/libsrc
-I/builddir/build/BUILD/netcdf-4.2.1/include
-I/builddir/build/BUILD/netcdf-4.2.1/oc2
-I/builddir/build/BUILD/netcdf-4.2.1/build
-I/builddir/build/BUILD/netcdf-4.2.1/libsrc/.    -o
CMakeFiles/netcdf3.dir/v1hpg.c.o   -c
/builddir/build/BUILD/netcdf-4.2.1/libsrc/v1hpg.c

This fixes it:

Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt      (revision 2631)
+++ CMakeLists.txt      (working copy)
@@ -26,7 +26,7 @@
  SET (LIB_TYPE STATIC)
  IF (BUILD_SHARED_LIBS)
         SET(LIB_TYPE SHARED)
-       SET(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -fPIC)
+       SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
  ENDIF()

  ADD_DEFINITIONS()



Still present in 2650, but needed a new patch:

Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt      (revision 2650)
+++ CMakeLists.txt      (working copy)
@@ -23,7 +23,7 @@
 IF (BUILD_SHARED_LIBS)
        SET(LIB_TYPE SHARED)
        IF(CMAKE_COMPILER_IS_GNUCC)
-               SET(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -fPIC)
+               SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
        ENDIF()
 ENDIF()
 ADD_DEFINITIONS()


--
Orion Poplawski
Technical Manager                     303-415-9701 x222
NWRA, Boulder Office                  FAX: 303-415-9702
3380 Mitchell Lane                       orion@xxxxxxxx
Boulder, CO 80301                   http://www.nwra.com



  • 2012 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: