Hey, I'm not an expert on CMake. I've primarily been developing in Windows until the last few months, so I'm used to building up manually from Visual Studio. If that does it, outstanding! I'll let you know once I've had a chance to test it out. If the /MD is still in the list, I couldn't see it, but that certainly doesn't mean it's not still there. So this is great! Thanks, Chad!

On 2/24/2015 9:47 PM, Chad Vernon wrote:
This worked for me without an error on the first run.


if (WIN32)
set(CMAKE_CONFIGURATION_TYPES Debug Release)
endif()

# Project must be called after setting the configuration types
project(sampleplugin)

if (WIN32)
  foreach (flag_var
 CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE)
      string(REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
  endforeach()
endif()


I think in yours the /MD flag is still in the flag list. But whatever works!


On Tue, Feb 24, 2015 at 7:12 PM, Joe Weidenbach <[email protected] <mailto:[email protected]>> wrote:

    On that note, I also adjusted my CMake Template File with the
    following options for windows builds (at the end of the file):

    # Disable CMake's default MinSizeRel and RelWithDebugInfo Build
    Targets for Visual Studio.
    # This WILL error out on the first run. Run it again and
    everything will be fine.
    IF (CMAKE_CONFIGURATION_TYPES AND CMAKE_CONFIGURATION_TYPES
    MATCHES MinSizeRel)
    set (cfgs ${CMAKE_CONFIGURATION_TYPES})
    list (REMOVE_ITEM cfgs MinSizeRel)
    list (REMOVE_ITEM cfgs RelWithDebInfo)
    set (CMAKE_CONFIGURATION_TYPES ${cfgs} CACHE STRING "Limited
    Configs" FORCE)
    message (FATAL_ERROR "List of configurations was reset, please
    re-run cmake. This message is normal.")
    ENDIF (CMAKE_CONFIGURATION_TYPES AND CMAKE_CONFIGURATION_TYPES
    MATCHES MinSizeRel)

    IF (MSVC)
    SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
    SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
    ENDIF (MSVC)

That seems to take care of setting that up properly by default. It also gets rid of the default MinSizeRel and RelWithDebugInfo
    build targets.  It seems (from my research) to be a known bug that
    on the first pass CMake will build those regardless of what you
    tell it to do, so the easy way is to throw an error and ask the
    user to re-run so the cache is fixed.

    Hope that helps anyone down the road :).

    Joe

    On Tue, Feb 24, 2015 at 5:59 PM, Joe Weidenbach <[email protected]
    <mailto:[email protected]>> wrote:

        Woo!  Ok, apparently I did build it on debug mode, and /MD was
        set.  So, I switched it over to /MT and that fixed it,
        according to my virtual machine that's now up and running :)
         I'll have to check it out on Friday when I'm at the school to
        confirm, but that looks like it sorted it.

        Thanks Chad (and Marcus for the GREAT VM reminder :))!

        On Tue, Feb 24, 2015 at 12:00 PM, Chad Vernon
        <[email protected] <mailto:[email protected]>> wrote:

            This typically happens while compiling in debug mode and
            has to do with the Runtime Library flag. This usually
            happens when it is set to /MD or /MDd which makes it use
            the dll versions of the runtime libraries. Using /MT or
            /MTd use the static runtime library.


                  To set this compiler option in the Visual Studio
                  development environment

            1.

                Open the project's Property Pages dialog box. For
                details, see How to: Open Project Property Pages
                <https://msdn.microsoft.com/en-us/library/e79xc5h1.aspx>.

            2.

                Expand the C/C++ folder.

            3.

                Select the Code Generation property page.

            4.

                Modify the Runtime Library property.

            See this page for more details:
            
https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx?f=255&MSPPError=-2147217396
            <tel:2147217396>


            On Monday, February 23, 2015 at 1:06:11 PM UTC-8, Marcus
            Ottosson wrote:

                You're very welcome, Joe. Happy to help. :)

                On Monday, 23 February 2015, Joe Weidenbach
                <[email protected]> wrote:

                    Thank you thank you thank you Marcus!!!

                    Oddly enough, after 8 years in a mixed
                    programming/IT role, I hadn't even considered
                    using a VM.  Brilliant!

                    Also, the technical info is great!  Much appreciated!

                    Thanks,

                    Joe

                    On Mon, Feb 23, 2015 at 12:24 PM, Marcus Ottosson
                    <[email protected]> wrote:

                        Set up a virtual machine - such as VMWare or
                        VirtualBox - and try it out on a clean Windows
                        install.​

                        In general, anything built using Visual Studio
                        requires a re-distributable for the
                        corresponding version; e.g. Visual Studio 2010
                        will link against dlls that your users can get
                        a hold of via the Visual Studio 2010
                        re-distributable.

                        But you can also bundle them. You’re typically
                        looking for two dll’s; msvcr100 and msvcp100
                        for the 2010 version, but it depends on what
                        you use. For example, here’s all files
                        included in the 2013 re-distributable.

                        |mfc120.dll
                        mfc120u.dll
                        mfcm120.dll
                        mfcm120u.dll
                        msvcp120.dll
                        msvcr120.dll
                        vcamp120.dll
                        vcomp120.dll
                        |

                        That, along with any other libraries you
                        dynamically linked with will need to be included.

                        You can use Dependency Walker to find out
                        exactly which; it hooks into an executable and
                        “spies” on which libraries it imports.

                          * http://www.dependencywalker.com/

                        It can be a bit cryptic to use at first but
                        it’s the go-to tool for these type of situations.

                        Good luck!

                        Best,
                        Marcus

                        ​
-- You received this message because you are
                        subscribed to the Google Groups "Python
                        Programming for Autodesk Maya" group.
                        To unsubscribe from this group and stop
                        receiving emails from it, send an email to
                        [email protected].
                        To view this discussion on the web visit
                        
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCo6WHBagky29EWLSVfC8%2B0zy4EN_y404-%3DOtSE1fOQgQ%40mail.gmail.com
                        
<https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCo6WHBagky29EWLSVfC8%2B0zy4EN_y404-%3DOtSE1fOQgQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.


                        For more options, visit
                        https://groups.google.com/d/optout.


-- You received this message because you are
                    subscribed to the Google Groups "Python
                    Programming for Autodesk Maya" group.
                    To unsubscribe from this group and stop receiving
                    emails from it, send an email to
                    [email protected].
                    To view this discussion on the web visit
                    
https://groups.google.com/d/msgid/python_inside_maya/CAM33%3Da72tbX6k01Lnk2HqW%3D6mkHBh%2BeDOfkEr2G4ZvoHKw_quw%40mail.gmail.com
                    
<https://groups.google.com/d/msgid/python_inside_maya/CAM33%3Da72tbX6k01Lnk2HqW%3D6mkHBh%2BeDOfkEr2G4ZvoHKw_quw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
                    For more options, visit
                    https://groups.google.com/d/optout.



-- *Marcus Ottosson*
                [email protected]

-- You received this message because you are subscribed to
            the Google Groups "Python Programming for Autodesk Maya"
            group.
            To unsubscribe from this group and stop receiving emails
            from it, send an email to
            [email protected]
            <mailto:[email protected]>.
            To view this discussion on the web visit
            
https://groups.google.com/d/msgid/python_inside_maya/73db7740-8445-425a-a399-53f06d55b810%40googlegroups.com
            
<https://groups.google.com/d/msgid/python_inside_maya/73db7740-8445-425a-a399-53f06d55b810%40googlegroups.com?utm_medium=email&utm_source=footer>.


            For more options, visit https://groups.google.com/d/optout.



-- You received this message because you are subscribed to a topic in
    the Google Groups "Python Programming for Autodesk Maya" group.
    To unsubscribe from this topic, visit
    
https://groups.google.com/d/topic/python_inside_maya/h5jyMZSigNQ/unsubscribe.
    To unsubscribe from this group and all its topics, send an email
    to [email protected]
    <mailto:[email protected]>.
    To view this discussion on the web visit
    
https://groups.google.com/d/msgid/python_inside_maya/CAM33%3Da7nySVMMkZWE9UVUQauTTss783Xxcy4YqtjtbVsTVB0hg%40mail.gmail.com
    
<https://groups.google.com/d/msgid/python_inside_maya/CAM33%3Da7nySVMMkZWE9UVUQauTTss783Xxcy4YqtjtbVsTVB0hg%40mail.gmail.com?utm_medium=email&utm_source=footer>.


    For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFi_Qyyqr7Owhg25xxbofqcQRk5%2BugGTq1Q6EVMsSn423iZVow%40mail.gmail.com <https://groups.google.com/d/msgid/python_inside_maya/CAFi_Qyyqr7Owhg25xxbofqcQRk5%2BugGTq1Q6EVMsSn423iZVow%40mail.gmail.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.



---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com

--
You received this message because you are subscribed to the Google Groups "Python 
Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/54ED7995.50501%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to