[CMake] Problem with linker on win32

uruloki at free.fr uruloki at free.fr
Fri Sep 2 03:15:33 EDT 2011


Hello

I'm trying to use CMake to build a very large project on Win32 with MSVC.
So far this project was using SNIFF ( an old EDI) and cygwin make.

It's almost working but i've got a small problem, that is the link is done with cl instead of link.
of course it doesn't work...

I've not changed the CMAKE_LINKER variables.
Problem occurs only when linking the executable, i have also a dll and it is built correctly.

main CmakeLists.txt :
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cmake_minimum_required(VERSION 2.8)


include_directories(o:/devstudio/vc98/include)
include_directories(o:/rw/7.0)


set(CMAKE_VERBOSE_MAKEFILE ON)

set(CMAKE_BUILD_TYPE DEBUG)

add_subdirectory(libUtg)
add_subdirectory(exeUtg)
#add_subdirectory(testUtg)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~	
from dll:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cmake_minimum_required(VERSION 2.8)
Project(libUtg)


include_directories(../UtgLOOP)
			include_directories(../UtgRessources)

	
file (
			GLOB 
			UtgLOOP 
			../UtgLOOP/*.?xx
			)
file (
			GLOB 
			UtgRessources 
			../UtgRessources/*.?xx
			)
			
file (
			GLOB 
			UtgRessourcesObj 
			../UtgRessources/*.o
			)			

add_definitions(-DUTG_BUILD)

	
add_library( libUtg
	SHARED
			${UtgLOOP}
			${UtgRessources}
			${UtgRessourcesObj}
	
	)

  target_link_libraries(libUtg 
shell32.lib
Advapi32.lib
Comdlg32.lib
user32.lib
gdi32.lib
imagehlp.lib
Ws2_32.lib)	
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

And from exe:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cmake_minimum_required(VERSION 2.8)
Project(exeUtg)

include_directories(../UtgOutils)
			

	
file (
	GLOB 
	exeUtg_SRC
	../exeUtg/*.?xx
)



	
add_executable( exeUtgLibelles
	${exeUtgLibelles_SRC}
)

target_link_libraries(exeUtgLibelles libUtg.lib)	
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


What could be the meaning of this error?

regards

Nicolas


More information about the CMake mailing list