[CMake] linking
Hector Franco Penya
hecfran at alumni.uv.es
Fri Feb 9 05:26:45 EST 2007
Thank Bill,
but it doesn't resolve the problem, the shell still displays the same error.
now the CMakeLists.txt contains:
SET(CMAKE_CXX_FLAGS "-fPIC -D_REENTRANT -g -c -I./binreloc
-I../../include -I./Counters -Wall -Wextra -DGCC_HASCLASSVISIBILITY
-DAUTILITYLIB_API_EXPORTS -DENABLE_BINRELOC ") #these sentence pass
parameters to the compiler gcc
message("Using these parameters : ${CMAKE_CXX_FLAGS}")
include_directories("${PROJECT_BINARY_DIR}")
FOREACH (carpeta
binreloc
Exception
MD5
Counters
)
include_directories("${PROJECT_SOURCE_DIR}/${carpeta}") #It mast be
included all the directories that are used.
#add_subdirectory(${carpeta})
ENDFOREACH(carpeta)
# .so.0.0.1
add_library (arisutil SHARED Precompiled.cpp binreloc/binreloc.c
Exception/Exception.cpp MD5/MD5.cpp Counters/Counters.cpp
Counters/SharedMemory.cpp Counters/Loader.cpp Counters/Snapshot.cpp
Counters/Counters_Built-in.cpp)
SET_TARGET_PROPERTIES(arisutil PROPERTIES LINK_FLAGS "-Wall -Wextra
-D_REENTRANT" SOVERSION 0.0.1)
-------------
in the shell:
hector at hector-laptop:~/arisnova/aUtilityLib/src/aUtilityLib$ cmake .
Using these parameters : -fPIC -D_REENTRANT -g -c -I./binreloc
-I../../include -I./Counters -Wall -Wextra -DGCC_HASCLASSVISIBILITY
-DAUTILITYLIB_API_EXPORTS -DENABLE_BINRELOC
-- Configuring done
-- Generating done
-- Build files have been written to:
/home/hector/arisnova/aUtilityLib/src/aUtilityLib
hector at hector-laptop:~/arisnova/aUtilityLib/src/aUtilityLib$ make
[ 11%] Building CXX object CMakeFiles/arisutil.dir/Precompiled.o
[ 22%] Building C object CMakeFiles/arisutil.dir/binreloc/binreloc.o
[ 33%] Building CXX object CMakeFiles/arisutil.dir/Exception/Exception.o
[ 44%] Building CXX object CMakeFiles/arisutil.dir/MD5/MD5.o
[ 55%] Building CXX object CMakeFiles/arisutil.dir/Counters/Counters.o
/home/hector/arisnova/aUtilityLib/src/aUtilityLib/Counters/SharedMemory.h:54:
warning: 'autil::SHARED_MEMORY_MAP_FILENAME' defined but not used
/home/hector/arisnova/aUtilityLib/src/aUtilityLib/Counters/SharedMemory.h:57:
warning: 'autil::HEADER_MAGIC' defined but not used
/home/hector/arisnova/aUtilityLib/src/aUtilityLib/Counters/SharedMemory.h:59:
warning: 'autil::HEADER_DATETIME_MASK' defined but not used
[ 66%] Building CXX object CMakeFiles/arisutil.dir/Counters/SharedMemory.o
[ 77%] Building CXX object CMakeFiles/arisutil.dir/Counters/Loader.o
[ 88%] Building CXX object CMakeFiles/arisutil.dir/Counters/Snapshot.o
/home/hector/arisnova/aUtilityLib/src/aUtilityLib/Counters/SharedMemory.h:54:
warning: 'autil::SHARED_MEMORY_MAP_FILENAME' defined but not used
/home/hector/arisnova/aUtilityLib/src/aUtilityLib/Counters/SharedMemory.h:57:
warning: 'autil::HEADER_MAGIC' defined but not used
/home/hector/arisnova/aUtilityLib/src/aUtilityLib/Counters/SharedMemory.h:59:
warning: 'autil::HEADER_DATETIME_MASK' defined but not used
../../include/aUtilityLib/Counters.h:60: warning:
'autil::AUTIL_COUNTERS_DATA_FILENAME' defined but not used
../../include/aUtilityLib/Counters.h:65: warning:
'autil::AUTIL_COUNTERS_CONFIG_FILENAME' defined but not used
[100%] Building CXX object CMakeFiles/arisutil.dir/Counters/Counters_Built-in.o
../../include/aUtilityLib/Counters.h:60: warning:
'autil::AUTIL_COUNTERS_DATA_FILENAME' defined but not used
../../include/aUtilityLib/Counters.h:65: warning:
'autil::AUTIL_COUNTERS_CONFIG_FILENAME' defined but not used
Linking CXX shared library libarisutil.so
c++: -soname: linker input file unused because linking not done
c++: libarisutil.so.0.0.1: linker input file unused because linking not done
c++: CMakeFiles/arisutil.dir/Precompiled.o: linker input file unused
because linking not done
c++: CMakeFiles/arisutil.dir/binreloc/binreloc.o: linker input file
unused because linking not done
c++: CMakeFiles/arisutil.dir/Exception/Exception.o: linker input file
unused because linking not done
c++: CMakeFiles/arisutil.dir/MD5/MD5.o: linker input file unused
because linking not done
c++: CMakeFiles/arisutil.dir/Counters/Counters.o: linker input file
unused because linking not done
c++: CMakeFiles/arisutil.dir/Counters/SharedMemory.o: linker input
file unused because linking not done
c++: CMakeFiles/arisutil.dir/Counters/Loader.o: linker input file
unused because linking not done
c++: CMakeFiles/arisutil.dir/Counters/Snapshot.o: linker input file
unused because linking not done
c++: CMakeFiles/arisutil.dir/Counters/Counters_Built-in.o: linker
input file unused because linking not done
[100%] Built target arisutil
--------------
On 09/02/07, Bill Hoffman <bill.hoffman at kitware.com> wrote:
> Hector Franco Penya wrote:
> > \
> > SET(CMAKE_CXX_FLAGS "-fPIC -D_REENTRANT -g -c -I./binreloc
> > -I../../include -I./Counters -Wall -Wextra -shared
> > -DGCC_HASCLASSVISIBILITY -DAUTILITYLIB_API_EXPORTS -DENABLE_BINRELOC
> > ") #these sentence pass parameters to the compiler gcc
> >
> Your problem is that you have set -shared as a compile flag for .o
> files. That tells gcc to create a shared library. So, the compiler is
> trying to make each .o file into its own shared library. Take that out
> of CXX_FLAGS and you should be OK.
>
>
> -Bill
>
>
--
Hector Franco Penya
Universidad de Valencia
Phone 651196424
More information about the CMake
mailing list