Commit 9789fe0e authored by Bill Hoffman's avatar Bill Hoffman
Browse files

ENH: merge in changes from the main tree

parent 909714cc
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.
......
......@@ -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)
......@@ -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
......
......@@ -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
......
......@@ -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:
......
......@@ -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)
{
......
......@@ -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())
{
......
......@@ -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)
project(TargetName)
add_subdirectory(executables)
add_subdirectory(scripts)
add_executable(hello_world hello_world.c)
#include <stdio.h>
main()
{
printf("hello, world\n");
}
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}")
#!/bin/sh
echo "hello, world"
......@@ -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
......
......@@ -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}")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment