~ubuntu-branches/ubuntu/lucid/cmake/lucid

« back to all changes in this revision

Viewing changes to Source/cmCoreTryCompile.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Artur Rona
  • Date: 2009-12-16 11:11:54 UTC
  • mfrom: (3.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20091216111154-6accvv6yq86h2hkc
Tags: 2.8.0-5ubuntu1
* Merge from debian testing (LP: #497349). Remaining changes:
  - Keep the Replaces: on cmake-data to cover the Kubuntu version from
    Jaunty in case someone decides to do an (unsupported) Jaunty->Lucid
    upgrade.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*=========================================================================
2
 
 
3
 
  Program:   CMake - Cross-Platform Makefile Generator
4
 
  Module:    $RCSfile: cmCoreTryCompile.cxx,v $
5
 
  Language:  C++
6
 
  Date:      $Date: 2009-02-04 16:44:17 $
7
 
  Version:   $Revision: 1.7.2.3 $
8
 
 
9
 
  Copyright (c) 2007 Kitware, Inc., Insight Consortium.  All rights reserved.
10
 
  See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
11
 
 
12
 
     This software is distributed WITHOUT ANY WARRANTY; without even 
13
 
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14
 
     PURPOSE.  See the above copyright notices for more information.
15
 
 
16
 
=========================================================================*/
 
1
/*============================================================================
 
2
  CMake - Cross Platform Makefile Generator
 
3
  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
 
4
 
 
5
  Distributed under the OSI-approved BSD License (the "License");
 
6
  see accompanying file Copyright.txt for details.
 
7
 
 
8
  This software is distributed WITHOUT ANY WARRANTY; without even the
 
9
  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
10
  See the License for more information.
 
11
============================================================================*/
17
12
#include "cmCoreTryCompile.h"
18
13
#include "cmake.h"
19
14
#include "cmCacheManager.h"
22
17
 
23
18
int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
24
19
{
25
 
  
26
20
  this->BinaryDirectory = argv[1].c_str();
27
21
  this->OutputFile = "";
28
22
  // which signature were we called with ?
251
245
      flag += this->Makefile->GetSafeDefinition("CMAKE_OSX_ARCHITECTURES");
252
246
      cmakeFlags.push_back(flag);
253
247
      }
 
248
    /* on APPLE also pass CMAKE_OSX_SYSROOT to the try_compile */
 
249
    if(this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT")!=0)
 
250
      {
 
251
      std::string flag="-DCMAKE_OSX_SYSROOT=";
 
252
      flag += this->Makefile->GetSafeDefinition("CMAKE_OSX_SYSROOT");
 
253
      cmakeFlags.push_back(flag);
 
254
      }
 
255
    /* on APPLE also pass CMAKE_OSX_DEPLOYMENT_TARGET to the try_compile */
 
256
    if(this->Makefile->GetDefinition("CMAKE_OSX_DEPLOYMENT_TARGET")!=0)
 
257
      {
 
258
      std::string flag="-DCMAKE_OSX_DEPLOYMENT_TARGET=";
 
259
      flag += this->Makefile->GetSafeDefinition("CMAKE_OSX_DEPLOYMENT_TARGET");
 
260
      cmakeFlags.push_back(flag);
 
261
      }
254
262
 
255
263
    fprintf(fout, "ADD_EXECUTABLE(cmTryCompileExec \"%s\")\n",source.c_str());
256
264
    fprintf(fout, 
284
292
                                       this->BinaryDirectory.c_str(),
285
293
                                       projectName, 
286
294
                                       targetName, 
 
295
                                       this->SrcFileSignature,
287
296
                                       &cmakeFlags, 
288
297
                                       &output);
289
298
  if ( erroroc )
305
314
  if (this->SrcFileSignature)
306
315
    {
307
316
    this->FindOutputFile(targetName);
 
317
 
308
318
    if ((res==0) && (copyFile.size()))
309
319
      {
310
 
      if(!cmSystemTools::CopyFileAlways(this->OutputFile.c_str(), 
 
320
      if(this->OutputFile.empty() ||
 
321
         !cmSystemTools::CopyFileAlways(this->OutputFile.c_str(),
311
322
                                        copyFile.c_str()))
312
323
        {
313
324
        cmOStringStream emsg;
314
325
        emsg << "Could not COPY_FILE.\n"
315
326
          << "  OutputFile: '" << this->OutputFile.c_str() << "'\n"
316
327
          << "    copyFile: '" << copyFile.c_str() << "'\n";
 
328
 
 
329
        if (this->FindErrorMessage.size())
 
330
          {
 
331
          emsg << "\n";
 
332
          emsg << this->FindErrorMessage.c_str() << "\n";
 
333
          }
 
334
 
317
335
        cmSystemTools::Error(emsg.str().c_str());
318
336
        return -1;
319
337
        }