[CMake] simple project in Visual Studio 2008

Yuri V. Timenkov ytimenkov at parallels.com
Tue Aug 19 08:05:04 EDT 2008


On Tuesday 19 August 2008 15:53:58 Jos.van.den.Oever at panalytical.com wrote:
> Hi all,
>
> I'm trying to build a simple project with Visual Studio Team System 2008.
> The project has one dll and one exe.
> On Linux the project compiles well. On Windows I get this output:
>
> C:\Jos\pd-3.1\test\build>devenv test.sln /rebuild
>
> Microsoft (R) Visual Studio Version 9.0.21022.8.
> Copyright (C) Microsoft Corp. All rights reserved.
> ------ Rebuild All started: Project: ZERO_CHECK, Configuration: Debug
> Win32 ----
> --
> Deleting intermediate and output files for project 'ZERO_CHECK',
> configuration '
> Debug|Win32'
> Checking Build System
> CMake does not need to re-run because CMakeFiles/generate.stamp is
> up-to-date.
> CMake does not need to re-run because lib/CMakeFiles/generate.stamp is
> up-to-dat
> e.
> CMake does not need to re-run because exe/CMakeFiles/generate.stamp is
> up-to-dat
> e.
> Build log was saved at
> "file://c:\Jos\pd-3.1\test\build\ZERO_CHECK.dir\Debug\Bui
> ldLog.htm"
> ZERO_CHECK - 0 error(s), 0 warning(s)
> ------ Rebuild All started: Project: mylib, Configuration: Debug Win32
> ------
> Deleting intermediate and output files for project 'mylib', configuration
> 'Debug
>
> |Win32'
>
> Building Custom Rule C:/Jos/pd-3.1/test/lib/CMakeLists.txt
> CMake does not need to re-run because CMakeFiles/generate.stamp is
> up-to-date.
> Compiling...
> mylib.cpp
> Compiling manifest to resources...
> Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
> Copyright (C) Microsoft Corporation.  All rights reserved.
> Linking...
> Embedding manifest...
> Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
> Copyright (C) Microsoft Corporation.  All rights reserved.
> Build log was saved at
> "file://c:\Jos\pd-3.1\test\build\lib\mylib.dir\Debug\Buil
> dLog.htm"
> mylib - 0 error(s), 0 warning(s)
> ------ Rebuild All started: Project: myexe, Configuration: Debug Win32
> ------
> Deleting intermediate and output files for project 'myexe', configuration
> 'Debug
>
> |Win32'
>
> Building Custom Rule C:/Jos/pd-3.1/test/exe/CMakeLists.txt
> CMake does not need to re-run because CMakeFiles/generate.stamp is
> up-to-date.
> Compiling...
> exe.cpp
> Compiling manifest to resources...
> Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
> Copyright (C) Microsoft Corporation.  All rights reserved.
> Linking...
> LINK : fatal error LNK1104: cannot open file '..\lib\Debug\mylib.lib'
> Build log was saved at
> "file://c:\Jos\pd-3.1\test\build\exe\myexe.dir\Debug\Buil
> dLog.htm"
> myexe - 1 error(s), 0 warning(s)
> ------ Skipped Rebuild All: Project: ALL_BUILD, Configuration: Debug Win32
> -----
> -
> Project not selected to build for this solution configuration
> ========== Rebuild All: 2 succeeded, 1 failed, 1 skipped ==========
>
> So even though I use add_library(mylib mylib.cpp) and the dll is built,
> the linker want to have a .lib file for building the dll.
Are following posts solve your problem?

http://www.cmake.org/pipermail/cmake/2008-July/023099.html
http://www.cmake.org/pipermail/cmake/2006-September/011100.html
http://www.cmake.org/pipermail/cmake/2005-February/006080.html

>
> == CMakeLists.txt ==
> cmake_minimum_required(VERSION 2.6)
> project(test)
> add_subdirectory(lib)
> add_subdirectory(exe)
> == lib/CMakeLists.txt ==
> add_library(mylib SHARED mylib.cpp)
> include_directories(../lib)
> == exe/CMakeLists.txt ==
> add_executable(myexe exe.cpp)
> target_link_libraries(myexe mylib)
>
> In CMake I select ''Visual Studio 9 2008'' as the target.
>
> Cheers,
> Jos
>
>
> Jos van den Oever - SW Engineering
>
> PANalytical
> Lelyweg 1
> 7602 EA Almelo
> The Netherlands
> T   +31 (0)546 528
> F   +31 (0)546 534598
> Jos.van.den.Oever at panalytical.com
> www.PANalytical.com
>
>
>  PANalytical
> The Analytical X-ray Company
>
> The information contained in this message is confidential and may be
> legally privileged. The message is intended solely for the addressee(s).
> If you are not the intended recipient, you are hereby notified that any
> use, dissemination, or reproduction is strictly prohibited and may be
> unlawful. If you are not the intended recipient, please contact the sender
> by return e-mail and destroy all copies of the original message.



More information about the CMake mailing list