summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2006-11-28 14:19:45 -0500
committerBill Hoffman <bill.hoffman@kitware.com>2006-11-28 14:19:45 -0500
commit9789fe0ec2989d28880b43c4cebdaefc5bced753 (patch)
tree60776550591fe9911a70db80c51f9d92a664e2a3
parent909714cc23c0630e055b6835325641ad1e44d8a0 (diff)
downloadcmake-9789fe0ec2989d28880b43c4cebdaefc5bced753.tar.gz
ENH: merge in changes from the main tree
-rw-r--r--ChangeLog.manual12
-rw-r--r--Modules/FindKDE4.cmake10
-rw-r--r--Modules/FindQt3.cmake24
-rw-r--r--Source/CMakeLists.txt17
-rw-r--r--Source/cmLocalGenerator.cxx16
-rw-r--r--Source/cmMakefileTargetGenerator.cxx16
-rw-r--r--Source/cmTarget.cxx43
-rw-r--r--Tests/Simple/CMakeLists.txt5
-rw-r--r--Tests/TargetName/CMakeLists.txt4
-rw-r--r--Tests/TargetName/executables/CMakeLists.txt1
-rw-r--r--Tests/TargetName/executables/hello_world.c5
-rw-r--r--Tests/TargetName/scripts/.gitattributes1
-rw-r--r--Tests/TargetName/scripts/CMakeLists.txt13
-rwxr-xr-xTests/TargetName/scripts/hello_world2
-rw-r--r--Tests/Wrapping/CMakeLists.txt6
-rw-r--r--Utilities/cmcurl/CMakeLists.txt3
16 files changed, 156 insertions, 22 deletions
diff --git a/ChangeLog.manual b/ChangeLog.manual
index fc05ce359a..be790cddfa 100644
--- a/ChangeLog.manual
+++ b/ChangeLog.manual
@@ -1,3 +1,13 @@
+Changes in CMake 2.4.5
+
+* Do not depend on optimized libraries for a debug build and visa versa.
+
+* Fix target name matching custom command output
+
+* Fix FindQt3 so that it does not find qt4
+
+* Fix FindKDE4 so that it only looks for kde4-config
+
Changes in CMake 2.4.4
* CMake Version numbers on module directory
@@ -61,7 +71,7 @@ Changes in CMake 2.4.4
* Added APPEND option to ADD_CUSTOM_COMMAND, Added VERBATIM option to
ADD_CUSTOM_COMMAND and ADD_CUSTOM_TARGET
-* add NOT_IN_ALL option for ADD_LIBRARY and ADD_EXECUTABLE
+* add EXCLUDE_FROM_ALL option for ADD_LIBRARY and ADD_EXECUTABLE
* Fix automatic computation of binary path to work for subdirectories of out
of source directories. This addresses bug#3592.
diff --git a/Modules/FindKDE4.cmake b/Modules/FindKDE4.cmake
index 6d3b264a5e..615771cc75 100644
--- a/Modules/FindKDE4.cmake
+++ b/Modules/FindKDE4.cmake
@@ -12,8 +12,8 @@
FILE(TO_CMAKE_PATH "$ENV{KDEDIRS}" _KDEDIRS)
-# First try to find kde-config, for KDE4 soon to be renamed to kde4-config
-FIND_PROGRAM(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config kde-config
+# For KDE4 kde-config has been renamed to kde4-config
+FIND_PROGRAM(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config
PATHS
${CMAKE_INSTALL_PREFIX}/bin
${_KDEDIRS}
@@ -23,11 +23,11 @@ FIND_PROGRAM(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config kde-config
IF (NOT KDE4_KDECONFIG_EXECUTABLE)
- FIND_PROGRAM(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config kde-config )
+ FIND_PROGRAM(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config )
ENDIF (NOT KDE4_KDECONFIG_EXECUTABLE)
IF (KDE4_KDECONFIG_EXECUTABLE)
- # then ask kde-config for the kde data dirs
+ # then ask kde4-config for the kde data dirs
EXEC_PROGRAM(${KDE4_KDECONFIG_EXECUTABLE} ARGS --path data OUTPUT_VARIABLE _data_DIR )
FILE(TO_CMAKE_PATH "${_data_DIR}" _data_DIR)
@@ -58,7 +58,7 @@ IF (KDE4_KDECONFIG_EXECUTABLE)
ELSE (KDE4_KDECONFIG_EXECUTABLE)
IF (KDE4_FIND_REQUIRED)
- MESSAGE(FATAL_ERROR "ERROR: Could not find KDE4 kde-config")
+ MESSAGE(FATAL_ERROR "ERROR: Could not find KDE4 kde4-config")
ENDIF (KDE4_FIND_REQUIRED)
ENDIF (KDE4_KDECONFIG_EXECUTABLE)
diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake
index 592631893f..282665369b 100644
--- a/Modules/FindQt3.cmake
+++ b/Modules/FindQt3.cmake
@@ -280,17 +280,33 @@ IF(QT_FOUND)
ENDIF(QT_QT_LIBRARY MATCHES "qt-mt")
ENDIF(QT_FOUND)
+EXEC_PROGRAM(${QT_MOC_EXECUTABLE} ARGS "-v" OUTPUT_VARIABLE QTVERSION_MOC)
+EXEC_PROGRAM(${QT_UIC_EXECUTABLE} ARGS "-version" OUTPUT_VARIABLE QTVERSION_UI)
+SET(_QT_UIC_VERSION_3 FALSE)
+IF("${QTVERSION_UIC}" MATCHES ".* 3..*")
+ SET(_QT_UIC_VERSION_3 TRUE)
+ENDIF("${QTVERSION_UIC}" MATCHES ".* 3..*")
+
+SET(_QT_MOC_VERSION_3 FALSE)
+IF("${QTVERSION_MOC}" MATCHES ".* 3..*")
+ SET(_QT_MOC_VERSION_3 TRUE)
+ENDIF("${QTVERSION_MOC}" MATCHES ".* 3..*")
+
+SET(QT_WRAP_CPP FALSE)
IF (QT_MOC_EXECUTABLE)
- SET ( QT_WRAP_CPP "YES")
+ IF(_QT_MOC_VERSION_3)
+ SET ( QT_WRAP_CPP TRUE)
+ ENDIF(_QT_MOC_VERSION_3)
ENDIF (QT_MOC_EXECUTABLE)
+SET(QT_WRAP_UI FALSE)
IF (QT_UIC_EXECUTABLE)
- SET ( QT_WRAP_UI "YES")
+ IF(_QT_UIC_VERSION_3)
+ SET ( QT_WRAP_UI TRUE)
+ ENDIF(_QT_UIC_VERSION_3)
ENDIF (QT_UIC_EXECUTABLE)
-
-
MARK_AS_ADVANCED(
QT_INCLUDE_DIR
QT_QT_LIBRARY
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 955fd15137..10c3237c3c 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -365,6 +365,7 @@ IF(BUILD_TESTING)
# and not the ctest from the cmake building and testing
# cmake.
SET(CMAKE_CTEST_COMMAND "${EXECUTABLE_OUTPUT_PATH}/ctest")
+ SET(CMAKE_CMAKE_COMMAND "${EXECUTABLE_OUTPUT_PATH}/cmake")
# Should the long tests be run?
OPTION(CMAKE_RUN_LONG_TESTS "Should the long tests be run (such as Bootstrap)." ON)
@@ -390,6 +391,18 @@ IF(BUILD_TESTING)
--build-project TestTar
--test-command TestTarExec)
+ ADD_TEST(TargetName ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/TargetName"
+ "${CMake_BINARY_DIR}/Tests/TargetName"
+ --build-two-config
+ --build-generator ${CMAKE_TEST_GENERATOR}
+ --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
+ --build-project TargetName
+ --test-command ${CMAKE_CMAKE_COMMAND} -E compare_files
+ ${CMake_SOURCE_DIR}/Tests/TargetName/scripts/hello_world
+ ${CMake_BINARY_DIR}/Tests/TargetName/scripts/hello_world)
+
ADD_TEST(CustomCommand ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/CustomCommand"
@@ -729,7 +742,7 @@ IF(BUILD_TESTING)
QT_QT_LIBRARY
QT_UIC_EXE)
- IF (QT_FOUND AND QT_UIC_EXECUTABLE)
+ IF (QT_FOUND AND QT_WRAP_UI)
ADD_TEST(qtwrapping ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/Wrapping"
@@ -740,7 +753,7 @@ IF(BUILD_TESTING)
--build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin"
--test-command qtwrapping
)
- ENDIF (QT_FOUND AND QT_UIC_EXECUTABLE)
+ ENDIF (QT_FOUND AND QT_WRAP_UI)
ADD_TEST(testdriver1 ${CMAKE_CTEST_COMMAND}
--build-and-test
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index a6e44bd974..7afdb31c20 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1857,6 +1857,22 @@ std::string cmLocalGenerator::GetRealDependency(const char* inName,
// Look for a CMake target with the given name.
if(cmTarget* target = this->GlobalGenerator->FindTarget(0, name.c_str()))
{
+ // make sure it is not just a coincidence that the target name
+ // found is part of the inName
+ if(cmSystemTools::FileIsFullPath(inName))
+ {
+ std::string tLocation = target->GetLocation(config);
+ tLocation = cmSystemTools::GetFilenamePath(tLocation);
+ std::string depLocation = cmSystemTools::GetFilenamePath(
+ std::string(inName));
+ if(depLocation != tLocation)
+ {
+ // it is a full path to a depend that has the same name
+ // as a target but is in a different location so do not use
+ // the target as the depend
+ return inName;
+ }
+ }
switch (target->GetType())
{
case cmTarget::EXECUTABLE:
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index e87e8ab191..ecc46998de 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1136,7 +1136,13 @@ void cmMakefileTargetGenerator
{
return;
}
-
+ // Compute which library configuration to link.
+ cmTarget::LinkLibraryType linkType = cmTarget::OPTIMIZED;
+ if(cmSystemTools::UpperCase(
+ this->LocalGenerator->ConfigurationName.c_str()) == "DEBUG")
+ {
+ linkType = cmTarget::DEBUG;
+ }
// Keep track of dependencies already listed.
std::set<cmStdString> emitted;
@@ -1149,6 +1155,14 @@ void cmMakefileTargetGenerator
for(cmTarget::LinkLibraryVectorType::const_iterator lib = tlibs.begin();
lib != tlibs.end(); ++lib)
{
+ // skip the library if it is not general and the link type
+ // does not match the current target
+ if(lib->second != cmTarget::GENERAL &&
+ lib->second != linkType)
+ {
+ continue;
+ }
+
// Don't emit the same library twice for this target.
if(emitted.insert(lib->first).second)
{
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index b2c5dc29bc..6102fa7b6a 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -230,15 +230,41 @@ void cmTarget::TraceVSDependencies(std::string projFile,
unsigned int i;
for (i = 0; i < outsf->GetCustomCommand()->GetDepends().size(); ++i)
{
- std::string dep = cmSystemTools::GetFilenameName(
- outsf->GetCustomCommand()->GetDepends()[i]);
+ const std::string& fullName
+ = outsf->GetCustomCommand()->GetDepends()[i];
+ std::string dep = cmSystemTools::GetFilenameName(fullName);
if (cmSystemTools::GetFilenameLastExtension(dep) == ".exe")
{
dep = cmSystemTools::GetFilenameWithoutLastExtension(dep);
}
- // watch for target dependencies,
- if(this->Makefile->GetLocalGenerator()->
- GetGlobalGenerator()->FindTarget(0, dep.c_str()))
+ bool isUtility = false;
+ // see if we can find a target with this name
+ cmTarget* t = this->Makefile->GetLocalGenerator()->
+ GetGlobalGenerator()->FindTarget(0, dep.c_str());
+ if(t)
+ {
+ // if we find the target and the dep was given as a full
+ // path, then make sure it was not a full path to something
+ // else, and the fact that the name matched a target was
+ // just a coincident
+ if(cmSystemTools::FileIsFullPath(fullName.c_str()))
+ {
+ std::string tLocation = t->GetLocation(0);
+ tLocation = cmSystemTools::GetFilenamePath(tLocation);
+ std::string depLocation = cmSystemTools::GetFilenamePath(
+ std::string(fullName));
+ if(depLocation == tLocation)
+ {
+ isUtility = true;
+ }
+ }
+ // if it was not a full path then it must be a target
+ else
+ {
+ isUtility = true;
+ }
+ }
+ if(isUtility)
{
// add the depend as a utility on the target
this->AddUtility(dep.c_str());
@@ -737,7 +763,9 @@ void cmTarget::Emit( const std::string& lib,
{
// It's already been emitted
if( emitted.find(lib) != emitted.end() )
+ {
return;
+ }
// Emit the dependencies only if this library node hasn't been
// visited before. If it has, then we have a cycle. The recursion
@@ -797,7 +825,9 @@ void cmTarget::GatherDependencies( const cmMakefile& mf,
// If the library is already in the dependency map, then it has
// already been fully processed.
if( dep_map.find(lib) != dep_map.end() )
+ {
return;
+ }
const char* deps = mf.GetDefinition( (lib+"_LIB_DEPENDS").c_str() );
if( deps && strcmp(deps,"") != 0 )
@@ -857,7 +887,8 @@ const char* cmTarget::GetDirectory(const char* config)
this->Makefile->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH");
break;
default:
- return 0;
+ this->Directory = this->Makefile->GetStartOutputDirectory();
+ break;
}
if(this->Directory.empty())
{
diff --git a/Tests/Simple/CMakeLists.txt b/Tests/Simple/CMakeLists.txt
index 13abefe324..c098224cc4 100644
--- a/Tests/Simple/CMakeLists.txt
+++ b/Tests/Simple/CMakeLists.txt
@@ -10,3 +10,8 @@ add_library (simpleLib STATIC
)
target_link_libraries (simple simpleLib)
+
+# make sure optimized libs are not used by debug builds
+if(CMAKE_BUILD_TYPE MATCHES Debug)
+ target_link_libraries(simple optimized c:/not/here.lib )
+endif(CMAKE_BUILD_TYPE MATCHES Debug)
diff --git a/Tests/TargetName/CMakeLists.txt b/Tests/TargetName/CMakeLists.txt
new file mode 100644
index 0000000000..653286eb06
--- /dev/null
+++ b/Tests/TargetName/CMakeLists.txt
@@ -0,0 +1,4 @@
+project(TargetName)
+
+add_subdirectory(executables)
+add_subdirectory(scripts)
diff --git a/Tests/TargetName/executables/CMakeLists.txt b/Tests/TargetName/executables/CMakeLists.txt
new file mode 100644
index 0000000000..2671e3e900
--- /dev/null
+++ b/Tests/TargetName/executables/CMakeLists.txt
@@ -0,0 +1 @@
+add_executable(hello_world hello_world.c)
diff --git a/Tests/TargetName/executables/hello_world.c b/Tests/TargetName/executables/hello_world.c
new file mode 100644
index 0000000000..539d867e01
--- /dev/null
+++ b/Tests/TargetName/executables/hello_world.c
@@ -0,0 +1,5 @@
+#include <stdio.h>
+main()
+{
+ printf("hello, world\n");
+}
diff --git a/Tests/TargetName/scripts/.gitattributes b/Tests/TargetName/scripts/.gitattributes
new file mode 100644
index 0000000000..51b8ce901a
--- /dev/null
+++ b/Tests/TargetName/scripts/.gitattributes
@@ -0,0 +1 @@
+hello_world crlf=input
diff --git a/Tests/TargetName/scripts/CMakeLists.txt b/Tests/TargetName/scripts/CMakeLists.txt
new file mode 100644
index 0000000000..40d4e2fb0a
--- /dev/null
+++ b/Tests/TargetName/scripts/CMakeLists.txt
@@ -0,0 +1,13 @@
+if(NOT CMAKE_BINARY_DIR STREQUAL "${CMAKE_SOURCE_DIR}")
+ add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/hello_world
+ COMMAND ${CMAKE_COMMAND} -E copy
+ ${CMAKE_CURRENT_SOURCE_DIR}/hello_world ${CMAKE_CURRENT_BINARY_DIR}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/hello_world
+ )
+ add_custom_target(
+ hello_world_copy ALL
+ DEPENDS #hello_world
+ ${CMAKE_CURRENT_BINARY_DIR}/hello_world
+ )
+endif(NOT CMAKE_BINARY_DIR STREQUAL "${CMAKE_SOURCE_DIR}")
diff --git a/Tests/TargetName/scripts/hello_world b/Tests/TargetName/scripts/hello_world
new file mode 100755
index 0000000000..ea3a72c1ce
--- /dev/null
+++ b/Tests/TargetName/scripts/hello_world
@@ -0,0 +1,2 @@
+#!/bin/sh
+echo "hello, world"
diff --git a/Tests/Wrapping/CMakeLists.txt b/Tests/Wrapping/CMakeLists.txt
index 3b7684a7f0..e39375bcfe 100644
--- a/Tests/Wrapping/CMakeLists.txt
+++ b/Tests/Wrapping/CMakeLists.txt
@@ -104,8 +104,8 @@ SET (QT_WRAP_CPP "On")
SET (QT_MOC_EXE "echo")
INCLUDE( FindQt3 )
-IF (QT_FOUND AND QT_UIC_EXECUTABLE)
-
+IF (QT_FOUND AND QT_WRAP_UI)
+ message("found qt 3 test it...")
INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR} )
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} )
@@ -132,7 +132,7 @@ IF (QT_FOUND AND QT_UIC_EXECUTABLE)
TARGET_LINK_LIBRARIES(qtwrapping myqtlib)
TARGET_LINK_LIBRARIES( qtwrapping ${QT_LIBRARIES} )
-ENDIF (QT_FOUND AND QT_UIC_EXECUTABLE)
+ENDIF (QT_FOUND AND QT_WRAP_UI)
#
# FLTK Wrappers
diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt
index c32504f97f..52717ccaba 100644
--- a/Utilities/cmcurl/CMakeLists.txt
+++ b/Utilities/cmcurl/CMakeLists.txt
@@ -385,6 +385,9 @@ MACRO(CURL_INTERNAL_TEST CURL_TEST)
IF(${CURL_TEST})
SET(${CURL_TEST} 1 CACHE INTERNAL "Curl test ${FUNCTION}")
MESSAGE(STATUS "Performing Curl Test ${CURL_TEST} - Success")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Performing Curl Test ${CURL_TEST} passed with the following output:\n"
+ "${OUTPUT}\n")
ELSE(${CURL_TEST})
MESSAGE(STATUS "Performing Curl Test ${CURL_TEST} - Failed")
SET(${CURL_TEST} "" CACHE INTERNAL "Curl test ${FUNCTION}")