[CMake] Impossible to link SDLmain and LibXml2

2012-03-06 Thread julien.plu
Hi,

 

I have a problem with cmake not to compile but to link my .exe.

 

I use SDL, OpenGL, FMOD, LibXml2 and a personal library. But when I try to
compile my program LibXml2 and SDLmain are not include into the command line
to link my .exe.

 

Enclosed my CMakeList.txt and CMakeCache.txt and here the line for the
linker into build.make:

 

Output/shootspace.exe: C:/MinGW/lib/libSDL.dll.a

Output/shootspace.exe: C:/MinGW/lib/libfmodex.a

Output/shootspace.exe: CMakeFiles/shootspace.dir/build.make

Output/shootspace.exe: CMakeFiles/shootspace.dir/objects1.rsp

@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR)
--red --bold Linking CXX executable Output/shootspace.exe

/c/Program Files (x86)/CMake 2.8/bin/cmake.exe -E remove
-f CMakeFiles/shootspace.dir/objects.a

/C/MinGW/bin/ar.exe cr CMakeFiles/shootspace.dir/objects.a
@CMakeFiles/shootspace.dir/objects1.rsp

/C/MinGW/bin/g++.exe  -Wl,--whole-archive
CMakeFiles/shootspace.dir/objects.a -Wl,--no-whole-archive  -o
Output/shootspace.exe -Wl,--out-implib,Output/libshootspace.dll.a
-Wl,--major-image-version,0,--minor-image-version,0
-Lsource/lib/gtl/lib/mingw -lmingw32 /C/MinGW/lib/libSDL.dll.a -lpthread
-lglu32 -lopengl32 /C/MinGW/lib/libfmodex.a -lgtl -lkernel32 -luser32
-lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32

 

As you can see, LibXml2 library and SDLmain library are found in
CMakeCache.txt but not include in build.make because –lxml2 and –lSDLmain
are missing.

 

Why ? I do something wrong in my CMakeList.txt ?

 

Thanks in advance for your help.

 

Cheers.

 


---

Julien Plu

 

Etudiant en 2ème année de Master Ingénierie en Intelligence Artificielle à
l’Université Montpellier 2.

Mes projets Web sémantique : http://data.lirmm.fr

Page personnelle : http://jplu.developpez.com

Responsable de la rubrique Web sémantique
http://web-semantique.developpez.com/  de Developpez.com.

Fichier FOAF (version RDF) : http://jplu.developpez.com/julien

Fichier FOAF (version RDFa) : http://jplu.developpez.com/julien.html

Adresse mail personnelle : julien@redaction-developpez.com

Adresse mail universitaire : julien@etud.univ-montp2.fr

 

# This is the CMakeCache file.
# For build in directory: c:/Users/snake/workspaceCpp/ShootSpace
# It was generated by CMake: c:/Program Files (x86)/CMake 2.8/bin/cmake.exe
# You can edit this file to change values found and used by cmake.
# If you do not want to change any of the values, simply exit the editor.
# If you do want to change a value, simply edit, save, and exit the editor.
# The syntax for the file is as follows:
# KEY:TYPE=VALUE
# KEY is the name of a variable in the cache.
# TYPE is a hint to GUI's for the type of VALUE, DO NOT EDIT TYPE!.
# VALUE is the current value for the KEY.


# EXTERNAL cache entries


//Path to a program.
CMAKE_AR:FILEPATH=C:/MinGW/bin/ar.exe

//Choose the type of build, options are: None(CMAKE_CXX_FLAGS or
// CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.
CMAKE_BUILD_TYPE:STRING=

//Enable/Disable color output during build.
CMAKE_COLOR_MAKEFILE:BOOL=ON

//CXX compiler.
CMAKE_CXX_COMPILER:FILEPATH=C:/MinGW/bin/g++.exe

//Flags used by the compiler during all build types.
CMAKE_CXX_FLAGS:STRING=

//Flags used by the compiler during debug builds.
CMAKE_CXX_FLAGS_DEBUG:STRING=-g

//Flags used by the compiler during release minsize builds.
CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG

//Flags used by the compiler during release builds (/MD /Ob1 /Oi
// /Ot /Oy /Gs will produce slightly less optimized but smaller
// files).
CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG

//Flags used by the compiler during Release with Debug Info builds.
CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g

//Libraries linked by defalut with all C++ applications.
CMAKE_CXX_STANDARD_LIBRARIES:STRING=-lkernel32 -luser32 -lgdi32 -lwinspool 
-lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32

//C compiler.
CMAKE_C_COMPILER:FILEPATH=C:/MinGW/bin/gcc.exe

//Flags used by the compiler during all build types.
CMAKE_C_FLAGS:STRING=

//Flags used by the compiler during debug builds.
CMAKE_C_FLAGS_DEBUG:STRING=-g

//Flags used by the compiler during release minsize builds.
CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG

//Flags used by the compiler during release builds (/MD /Ob1 /Oi
// /Ot /Oy /Gs will produce slightly less optimized but smaller
// files).
CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG

//Flags used by the compiler during Release with Debug Info builds.
CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g

//Libraries linked by defalut with all C applications.
CMAKE_C_STANDARD_LIBRARIES:STRING=-lkernel32 -luser32 -lgdi32 -lwinspool 
-lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32

//Flags used by the linker.

Re: [CMake] Impossible to link SDLmain and LibXml2

2012-03-06 Thread Eric Noulard
2012/3/6  julien@redaction-developpez.com:
 Hi,



 I have a problem with cmake not to compile but to link my .exe.



 I use SDL, OpenGL, FMOD, LibXml2 and a personal library. But when I try to
 compile my program LibXml2 and SDLmain are not include into the command line
 to link my .exe.



 Enclosed my CMakeList.txt and CMakeCache.txt and here the line for the
 linker into build.make:



 Output/shootspace.exe: C:/MinGW/lib/libSDL.dll.a

 Output/shootspace.exe: C:/MinGW/lib/libfmodex.a

 Output/shootspace.exe: CMakeFiles/shootspace.dir/build.make

 Output/shootspace.exe: CMakeFiles/shootspace.dir/objects1.rsp

     @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR)
 --red --bold Linking CXX executable Output/shootspace.exe

     /c/Program Files (x86)/CMake 2.8/bin/cmake.exe -E remove
 -f CMakeFiles/shootspace.dir/objects.a

     /C/MinGW/bin/ar.exe cr CMakeFiles/shootspace.dir/objects.a
 @CMakeFiles/shootspace.dir/objects1.rsp

     /C/MinGW/bin/g++.exe  -Wl,--whole-archive
 CMakeFiles/shootspace.dir/objects.a -Wl,--no-whole-archive  -o
 Output/shootspace.exe -Wl,--out-implib,Output/libshootspace.dll.a
 -Wl,--major-image-version,0,--minor-image-version,0
 -Lsource/lib/gtl/lib/mingw -lmingw32 /C/MinGW/lib/libSDL.dll.a -lpthread
 -lglu32 -lopengl32 /C/MinGW/lib/libfmodex.a -lgtl -lkernel32 -luser32
 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32



 As you can see, LibXml2 library and SDLmain library are found in
 CMakeCache.txt but not include in build.make because –lxml2 and –lSDLmain
 are missing.



 Why ? I do something wrong in my CMakeList.txt ?

yes.
since you did
Find_Package(LibXml2 REQUIRED)

you'll have to:

target_link_libraries(
shootspace
${LIBXML2_LIBRARIES}

and not XML2_LIBRARY

in you CMakeCache.txt you'll see that SDLmain is not found.
//Path to a library.
SDLMAIN_LIBRARY:FILEPATH=SDLMAIN_LIBRARY-NOTFOUND

for SDL I suggest you read the documentation of the module:
cmake --help-module FindSDL
there are some explanation about SDLmain or not.

-- 
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Impossible to link SDLmain and LibXml2

2012-03-06 Thread Benjamin Eikel
Hello Julien,

Am Dienstag, 6. März 2012 um 20:58:43 schrieb julien.plu@redaction-
developpez.com:
 Why ? I do something wrong in my CMakeList.txt ?

You should use LIBXML2_LIBRARIES [1].

Kind regards
Benjamin

[1]http://cmake.org/cmake/help/cmake-2-8-docs.html#module:FindLibXml2
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Impossible to link SDLmain and LibXml2

2012-03-06 Thread julien.plu
Thanks, for libXml2 it was indeed LIBXML2_LIBRARIES instead of
LIBXML2_LIBRARY. And for SDLmain it was an error in one on my change on
findSDL.cmake file because I have replaced $ENV{SDLDIR} by another
environment variable.

Thanks again at all of you :-)

Cheers.


---
Julien Plu

Etudiant en 2ème année de Master Ingénierie en Intelligence Artificielle à
l’Université Montpellier 2.
Mes projets Web sémantique : http://data.lirmm.fr
Page personnelle : http://jplu.developpez.com
Responsable de la rubrique Web sémantique de Developpez.com.
Fichier FOAF (version RDF) : http://jplu.developpez.com/julien
Fichier FOAF (version RDFa) : http://jplu.developpez.com/julien.html
Adresse mail personnelle : julien@redaction-developpez.com
Adresse mail universitaire : julien@etud.univ-montp2.fr


-Message d'origine-
De : cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] De la part de
Benjamin Eikel
Envoyé : mardi 6 mars 2012 21:21
À : cmake@cmake.org
Objet : Re: [CMake] Impossible to link SDLmain and LibXml2

Hello Julien,

Am Dienstag, 6. März 2012 um 20:58:43 schrieb julien.plu@redaction-
developpez.com:
 Why ? I do something wrong in my CMakeList.txt ?

You should use LIBXML2_LIBRARIES [1].

Kind regards
Benjamin

[1]http://cmake.org/cmake/help/cmake-2-8-docs.html#module:FindLibXml2
--

Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake